home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Compilers⁄Interps / GCC-2.3.3r12 / Sources-Targets / m68k.md < prev    next >
Encoding:
Text File  |  1993-06-24  |  170.0 KB  |  6,056 lines  |  [TEXT/MPS ]

  1. ;;- Machine description for GNU compiler
  2. ;;- Motorola 68000 Version
  3. ;;   Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  4.  
  5. ;; This file is part of GNU CC.
  6.  
  7. ;; GNU CC is free software; you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation; either version 2, or (at your option)
  10. ;; any later version.
  11.  
  12. ;; GNU CC is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ;; GNU General Public License for more details.
  16.  
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU CC; see the file COPYING.  If not, write to
  19. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  
  22. ;;- instruction definitions
  23.  
  24. ;;- @@The original PO technology requires these to be ordered by speed,
  25. ;;- @@    so that assigner will pick the fastest.
  26.  
  27. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  28.  
  29. ;;- When naming insn's (operand 0 of define_insn) be careful about using
  30. ;;- names from other targets machine descriptions.
  31.  
  32. ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
  33. ;;- updates for most instructions.
  34.  
  35. ;;- Operand classes for the register allocator:
  36. ;;- 'a' one of the address registers can be used.
  37. ;;- 'd' one of the data registers can be used.
  38. ;;- 'f' one of the m68881 registers can be used
  39. ;;- 'r' either a data or an address register can be used.
  40. ;;- 'x' if one of the Sun FPA registers                    
  41. ;;- 'y' if one of the Low Sun FPA registers (fpa0-fpa15).
  42.  
  43. ;;- Immediate Floating point operator constraints
  44. ;;- 'G' a floating point constant that is *NOT* one of the standard
  45. ;;   68881 constant values (to force calling output_move_const_double
  46. ;;   to get it from rom if it is a 68881 constant).
  47. ;;- 'H' one of the standard FPA constant values
  48. ;;
  49. ;;   See the functions standard_XXX_constant_p in output-m68k.c for more
  50. ;; info.
  51.  
  52. ;;- Immediate integer operand constraints:
  53. ;;- 'I'  1 .. 8
  54. ;;- 'J'  -32768 .. 32767
  55. ;;- 'K'  all integers EXCEPT -128 .. 127
  56. ;;- 'L'  -8 .. -1
  57.  
  58. ;;- Assembler specs:
  59. ;;- "%."    size separator ("." or "")            move%.l d0,d1
  60. ;;- "%#"    immediate separator ("#" or "")        move%.l %#0,d0
  61. ;;- "%-"    push operand "sp@-"                move%.l d0,%-
  62. ;;- "%+"    pop operand "sp@+"                move%.l d0,%+
  63. ;;- "%@"    top of stack "sp@"                move%.l d0,%@
  64. ;;- "%!"    fpcr register
  65. ;;- "%$"    single-precision fp specifier ("s" or "")    f%$add.x fp0,fp1
  66. ;;- "%&"    double-precision fp specifier ("d" or "")    f%&add.x fp0,fp1
  67.  
  68. ;;- Information about 68040 port.
  69.  
  70. ;;- The 68040 executes all 68030 and 68881/2 instructions, but some must
  71. ;;- be emulated in software by the OS.  It is faster to avoid these
  72. ;;- instructions and issue a library call rather than trapping into
  73. ;;- the kernel.  The affected instructions are fintrz and fscale.  The
  74. ;;- TARGET_68040 flag turns the use of the opcodes off.
  75.  
  76. ;;- The '040 also implements a set of new floating-point instructions
  77. ;;- which specify the rounding precision in the opcode.  This finally
  78. ;;- permit the 68k series to be truly IEEE compliant, and solves all
  79. ;;- issues of excess precision accumulating in the extended registers.
  80. ;;- By default, GCC does not use these instructions, since such code will
  81. ;;- not run on an '030.  To use these instructions, use the -m68040-only
  82. ;;- switch.  By changing TARGET_DEFAULT to include TARGET_68040_ONLY,
  83. ;;- you can make these instructions the default.
  84.  
  85. ;;- These new instructions aren't directly in the md.  They are brought
  86. ;;- into play by defining "%$" and "%&" to expand to "s" and "d" rather
  87. ;;- than "".
  88.  
  89.  
  90. ;;-         FPA port explanation:
  91.  
  92. ;;-        Usage of the Sun FPA and the 68881 together
  93.  
  94. ;;- The current port of gcc to the sun fpa disallows use of the m68881
  95. ;;- instructions completely if code is targeted for the fpa.  This is
  96. ;;- for the following reasons:
  97.  
  98. ;;- 1) Expressing the preference hierarchy (ie. use the fpa if you
  99. ;;- can, the 68881 otherwise, and data registers only if you are
  100. ;;- forced to it) is a bitch with the current constraint scheme,
  101. ;;- especially since it would have to work for any combination of
  102. ;;- -mfpa, -m68881.
  103.  
  104. ;;- 2) There are no instructions to move between the two types of
  105. ;;- registers; the stack must be used as an intermediary.
  106.  
  107. ;;- It could indeed be done; I think the best way would be to have
  108. ;;- separate patterns for TARGET_FPA (which implies a 68881),
  109. ;;- TARGET_68881, and no floating point co-processor.  Use
  110. ;;- define_expands for all of the named instruction patterns, and
  111. ;;- include code in the FPA instruction to deal with the 68881 with
  112. ;;- preferences specifically set to favor the fpa.  Some of this has
  113. ;;- already been done:
  114. ;;-
  115. ;;-     1) Separation of most of the patterns out into a TARGET_FPA
  116. ;;- case and a TARGET_68881 case (the exceptions are the patterns
  117. ;;- which would need one define_expand and three define_insn's under
  118. ;;- it (with a lot of duplicate code between them) to replace the
  119. ;;- current single define_insn.  These are mov{[ds]f,[ds]i} and the
  120. ;;- first two patterns in the md.
  121. ;;-
  122. ;;- Some would still have to be done:
  123. ;;-
  124. ;;-    1) Add code to the fpa patterns which correspond to 68881
  125. ;;- patterns to deal with the 68881 case (including preferences!).
  126. ;;- What you might actually do here is combine the fpa and 68881 code
  127. ;;- back together into one pattern for those instructions where it's
  128. ;;- absolutely necessary and save yourself some duplicate code.  I'm
  129. ;;- not completely sure as to whether you could get away with doing
  130. ;;- this only for the mov* insns, or if you'd have to do it for all
  131. ;;- named insns.
  132. ;;-     2) Add code to the mov{[ds]f,[ds]i} instructions to handle
  133. ;;- moving between fpa regs and 68881 regs.
  134.  
  135. ;;- Since the fpa is more powerful than the 68881 and also has more
  136. ;;- registers, and since I think the resultant md would be medium ugly
  137. ;;- (lot's of duplicate code, ugly constraint strings), I elected not
  138. ;;- to do this change.
  139.  
  140. ;;- Another reason why someone *might* want to do the change is to
  141. ;;- control which register classes are accessed in a slightly cleaner
  142. ;;- way than I have.  See the blurb on CONDITIONAL_REGISTER_USAGE in
  143. ;;- the internals manual.
  144.  
  145. ;;- Yet another reason why someone might want to do this change is to
  146. ;;- allow use of some of the 68881 insns which have no equivalent on
  147. ;;- the fpa.  The sqrt instruction comes fairly quickly to mind.
  148.  
  149. ;;- If this is ever done, don't forget to change sun3.h so that
  150. ;;- it *will* define __HAVE_68881__ when the FPA is in use.
  151.  
  152. ;;-        Condition code hack
  153.  
  154. ;;- When a floating point compare is done in the fpa, the resulting
  155. ;;- condition codes are left in the fpastatus register.  The values in
  156. ;;- this register must be moved into the 68000 cc register before any
  157. ;;- jump is executed.  Once this has been done, regular jump
  158. ;;- instructions are fine (ie. floating point jumps are not necessary.
  159. ;;- They are only done if the cc is in the 68881).
  160.  
  161. ;;- The instructions that move the fpastatus register to the 68000
  162. ;;- register clobber a data register (the move cannot be done direct).
  163. ;;- These instructions might be bundled either with the compare
  164. ;;- instruction, or the branch instruction.  If we were using both the
  165. ;;- fpa and the 68881 together, we would wish to only mark the
  166. ;;- register clobbered if we were doing the compare in the fpa, but I
  167. ;;- think that that decision (whether to clobber the register or not)
  168. ;;- must be done before register allocation (makes sense) and hence we
  169. ;;- can't know if the floating point compare will be done in the fpa
  170. ;;- or the fp.  So whenever we are asked for code that uses the fpa,
  171. ;;- we will mark a data register as clobbered.  This is reasonable, as
  172. ;;- almost all floating point compare operations done with fpa code
  173. ;;- enabled will be done in the fpa.  It's even more reasonable since
  174. ;;- we decided to make the 68881 and the fpa mutually exclusive.
  175.  
  176. ;;- We place to code to move the fpastatus register inside of a
  177. ;;- define_expand so that we can do it conditionally based on whether
  178. ;;- we are targeting an fpa or not.
  179.  
  180. ;;- This still leaves us with the question of where we wish to put the
  181. ;;- code to move the fpastatus reg.  If we put it in the compare
  182. ;;- instruction, we can restrict the clobbering of the register to
  183. ;;- floating point compares, but we can't take advantage of floating
  184. ;;- point subtracts & etc. that alter the fpastatus register.  If we
  185. ;;- put it in the branch instruction, all branches compiled with fpa
  186. ;;- code enabled will clobber a data register, but we will be able to
  187. ;;- take advantage of fpa subtracts.  This balance favors putting the
  188. ;;- code in with the compare instruction.
  189.  
  190. ;;- Note that if some enterprising hacker should decide to switch
  191. ;;- this, he'll need to modify the code in NOTICE_UPDATE_CC.
  192.  
  193. ;;-        Usage of the top 16 fpa registers
  194.  
  195. ;;- The only locations which we may transfer fpa registers 16-31 from
  196. ;;- or to are the fpa registers 0-15.  (68000 registers and memory
  197. ;;- locations are impossible).  This causes problems in gcc, which
  198. ;;- assumes that mov?? instructions require no additional registers
  199. ;;- (see section 11.7) and since floating point moves *must* be
  200. ;;- supported into general registers (see section 12.3 under
  201. ;;- HARD_REGNO_OK_FOR_MODE_P) from anywhere.
  202.  
  203. ;;- My solution was to reserve fpa0 for moves into or out of these top
  204. ;;- 16 registers and to disparage the choice to reload into or out of
  205. ;;- these registers as much as I could.  That alternative is always
  206. ;;- last in the list, so it will not be used unless all else fails.  I
  207. ;;- will note that according to my current information, sun's compiler
  208. ;;- doesn't use these top 16 registers at all.
  209.  
  210. ;;- There is another possible way to do it.  I *believe* that if you
  211. ;;- make absolutely sure that the code will not be executed in the
  212. ;;- reload pass, you can support the mov?? names with define_expands
  213. ;;- which require new registers.  This may be possible by the
  214. ;;- appropriate juggling of constraints.  I may come back to this later.
  215.  
  216. ;;-         Usage of constant RAM
  217.  
  218. ;;- This has been handled correctly (I believe) but the way I've done
  219. ;;- it could use a little explanation.  The constant RAM can only be
  220. ;;- accessed when the instruction is in "command register" mode.
  221. ;;- "command register" mode means that no accessing of memory or the
  222. ;;- 68000 registers is being done.  This can be expressed easily in
  223. ;;- constraints, so generally the mode of the instruction is
  224. ;;- determined by a branch off of which_alternative.  In outputting
  225. ;;- instructions, a 'w' means to output an access to the constant ram
  226. ;;- (if the arg is CONST_DOUBLE and is one of the available
  227. ;;- constants), and 'x' means to output a register pair (if the arg is
  228. ;;- a 68000 register) and a 'y' is the combination of the above two
  229. ;;- processes.  You use a 'y' in two operand DF instructions where you
  230. ;;- *know* the other operand is an fpa register, you use an 'x' in DF
  231. ;;- instructions where the arg might be a 68000 register and the
  232. ;;- instruction is *not* in "command register" mode, and you use a 'w'
  233. ;;- in two situations: 1) The instruction *is* in command register
  234. ;;- mode (and hence won't be accessing 68000 registers), or 2) The
  235. ;;- instruction is a two operand SF instruction where you know the
  236. ;;- other operand is an fpa register.
  237.  
  238. ;;-        Optimization issues
  239.  
  240. ;;- I actually think that I've included all of the fpa instructions
  241. ;;- that should be included.  Note that if someone is interested in
  242. ;;- doing serious floating point work on the sun fpa, I would advise
  243. ;;- the use of the "asm" instruction in gcc to allow you to use the
  244. ;;- sin, cos, and exponential functions on the fpa board.
  245.  
  246. ;;- END FPA Explanation Section.
  247.  
  248.  
  249. ;;- Some of these insn's are composites of several m68000 op codes.
  250. ;;- The assembler (or final @@??) insures that the appropriate one is
  251. ;;- selected.
  252.  
  253. (define_insn ""
  254.   [(set (match_operand:DF 0 "push_operand" "=m")
  255.     (match_operand:DF 1 "general_operand" "ro<>fyE"))]
  256.   ""
  257.   "*
  258. {
  259.   if (FP_REG_P (operands[1]))
  260.     return \"fmove%.d %f1,%0\";
  261.   if (FPA_REG_P (operands[1]))
  262.     return \"fpmove%.d %1, %x0\";
  263.   return output_move_double (operands);
  264. }")
  265.  
  266. (define_insn ""
  267.   [(set (match_operand:DI 0 "push_operand" "=m")
  268.     (match_operand:DI 1 "general_operand" "ro<>Fy"))]
  269.   ""
  270.   "*
  271. {
  272.   return output_move_double (operands);
  273. }")
  274.  
  275. ;; We don't want to allow a constant operand for test insns because
  276. ;; (set (cc0) (const_int foo)) has no mode information.  Such insns will
  277. ;; be folded while optimizing anyway.
  278. (define_insn "tstsi"
  279.   [(set (cc0)
  280.     (match_operand:SI 0 "nonimmediate_operand" "rm"))]
  281.   ""
  282.   "*
  283. {
  284. #ifdef ISI_OV
  285.   /* ISI's assembler fails to handle tstl a0.  */
  286.   if (! ADDRESS_REG_P (operands[0]))
  287. #else
  288.   if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
  289. #endif
  290.     return \"tst%.l %0\";
  291.   /* If you think that the 68020 does not support tstl a0,
  292.      reread page B-167 of the 68020 manual more carefully.  */
  293.   /* On an address reg, cmpw may replace cmpl.  */
  294. #ifdef SGS_CMP_ORDER
  295.   return \"cmp%.w %0,%#0\";
  296. #else
  297.   return \"cmp%.w %#0,%0\";
  298. #endif
  299. }")
  300.  
  301. ;; This can't use an address register, because comparisons
  302. ;; with address registers as second operand always test the whole word.
  303. (define_insn "tsthi"
  304.   [(set (cc0)
  305.     (match_operand:HI 0 "nonimmediate_operand" "dm"))]
  306.   ""
  307.   "tst%.w %0")
  308.  
  309. (define_insn "tstqi"
  310.   [(set (cc0)
  311.     (match_operand:QI 0 "nonimmediate_operand" "dm"))]
  312.   ""
  313.   "tst%.b %0")
  314.   
  315. (define_expand "tstsf"
  316.   [(set (cc0)
  317.     (match_operand:SF 0 "general_operand" ""))]
  318.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  319.   "
  320. {
  321.   if (TARGET_FPA)
  322.     {
  323.       emit_insn (gen_tstsf_fpa (operands[0]));
  324.       DONE;
  325.     }
  326. }")
  327.  
  328. (define_insn "tstsf_fpa"
  329.   [(set (cc0)
  330.     (match_operand:SF 0 "general_operand" "xmdF"))
  331.    (clobber (match_scratch:SI 1 "=d"))]
  332.   "TARGET_FPA"
  333.   "fptst%.s %x0\;fpmove fpastatus,%1\;movw %1,cc")
  334.  
  335. (define_insn ""
  336.   [(set (cc0)
  337.     (match_operand:SF 0 "general_operand" "fdm"))]
  338.   "TARGET_68881"
  339.   "*
  340. {
  341.   cc_status.flags = CC_IN_68881;
  342.   if (FP_REG_P (operands[0]))
  343. #ifdef MPW_ASM
  344.     return \"ftest%.x %0\";
  345.   return \"ftest%.s %0\";
  346. #else
  347.     return \"ftst%.x %0\";
  348.   return \"ftst%.s %0\";
  349. #endif
  350. }")
  351.  
  352. (define_expand "tstdf"
  353.   [(set (cc0)
  354.     (match_operand:DF 0 "general_operand" ""))]
  355.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  356.   "
  357. {
  358.   if (TARGET_FPA)
  359.     {
  360.       emit_insn (gen_tstsf_fpa (operands[0]));
  361.       DONE;
  362.     }
  363. }")
  364.  
  365. (define_insn "tstdf_fpa"
  366.   [(set (cc0)
  367.     (match_operand:DF 0 "general_operand" "xrmF"))
  368.    (clobber (match_scratch:SI 1 "=d"))]
  369.   "TARGET_FPA"
  370.   "fptst%.d %x0\;fpmove fpastatus,%1\;movw %1,cc")
  371.  
  372. (define_insn ""
  373.   [(set (cc0)
  374.     (match_operand:DF 0 "general_operand" "fm"))]
  375.   "TARGET_68881"
  376.   "*
  377. {
  378.   cc_status.flags = CC_IN_68881;
  379.   if (FP_REG_P (operands[0]))
  380. #ifdef MPW_ASM
  381.     return \"ftest%.x %0\";
  382.   return \"ftest%.d %0\";
  383. #else
  384.     return \"ftst%.x %0\";
  385.   return \"ftst%.d %0\";
  386. #endif
  387. }")
  388.  
  389. ;; compare instructions.
  390.  
  391. ;; A composite of the cmp, cmpa, & cmpi m68000 op codes.
  392. ;; For the Mac version, we have to avoid getting symbols in here as operands.
  393. (define_insn "cmpsi"
  394.   [(set (cc0)
  395.     (compare (match_operand:SI 0 "nonimmediate_operand" "rK,mr,>")
  396.          (match_operand:SI 1 "general_operand" "mr,Kr,>")))]
  397.   ""
  398.   "*
  399. {
  400.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  401.     return \"cmpm%.l %1,%0\";
  402.   if (REG_P (operands[1])
  403.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  404.     { cc_status.flags |= CC_REVERSED;
  405. #ifdef SGS_CMP_ORDER
  406.       return \"cmp%.l %d1,%d0\";
  407. #else
  408.       return \"cmp%.l %d0,%d1\";
  409. #endif
  410.     }
  411. #ifdef SGS_CMP_ORDER
  412.   return \"cmp%.l %d0,%d1\";
  413. #else
  414.   return \"cmp%.l %d1,%d0\";
  415. #endif
  416. }")
  417.  
  418. (define_insn "cmphi"
  419.   [(set (cc0)
  420.     (compare (match_operand:HI 0 "nonimmediate_operand" "rnm,d,n,m")
  421.          (match_operand:HI 1 "general_operand" "d,rnm,m,n")))]
  422.   ""
  423.   "*
  424. {
  425.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  426.     return \"cmpm%.w %1,%0\";
  427.   if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
  428.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  429.     { cc_status.flags |= CC_REVERSED;
  430. #ifdef SGS_CMP_ORDER
  431.       return \"cmp%.w %d1,%d0\";
  432. #else
  433.       return \"cmp%.w %d0,%d1\";
  434. #endif
  435.     }
  436. #ifdef SGS_CMP_ORDER
  437.   return \"cmp%.w %d0,%d1\";
  438. #else
  439.   return \"cmp%.w %d1,%d0\";
  440. #endif
  441. }")
  442.  
  443. (define_insn "cmpqi"
  444.   [(set (cc0)
  445.     (compare (match_operand:QI 0 "nonimmediate_operand" "dn,md,>")
  446.          (match_operand:QI 1 "general_operand" "dm,nd,>")))]
  447.   ""
  448.   "*
  449. {
  450.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  451.     return \"cmpm%.b %1,%0\";
  452.   if (REG_P (operands[1])
  453.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  454.     { cc_status.flags |= CC_REVERSED;
  455. #ifdef SGS_CMP_ORDER
  456.       return \"cmp%.b %d1,%d0\";
  457. #else
  458.       return \"cmp%.b %d0,%d1\";
  459. #endif
  460.     }
  461. #ifdef SGS_CMP_ORDER
  462.   return \"cmp%.b %d0,%d1\";
  463. #else
  464.   return \"cmp%.b %d1,%d0\";
  465. #endif
  466. }")
  467.  
  468. (define_expand "cmpdf"
  469.   [(set (cc0)
  470.     (compare (match_operand:DF 0 "general_operand" "")
  471.          (match_operand:DF 1 "general_operand" "")))]
  472.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  473.   "
  474. {
  475.   if (TARGET_FPA)
  476.     {
  477.       emit_insn (gen_cmpdf_fpa (operands[0], operands[1]));
  478.       DONE;
  479.     }
  480. }")
  481.  
  482. (define_insn "cmpdf_fpa"
  483.   [(set (cc0)
  484.     (compare (match_operand:DF 0 "general_operand" "x,y")
  485.          (match_operand:DF 1 "general_operand" "xH,rmF")))
  486.    (clobber (match_scratch:SI 2 "=d,d"))]
  487.   "TARGET_FPA"
  488.   "fpcmp%.d %y1,%0\;fpmove fpastatus,%2\;movw %2,cc")
  489.  
  490. (define_insn ""
  491.   [(set (cc0)
  492.     (compare (match_operand:DF 0 "general_operand" "f,mG")
  493.          (match_operand:DF 1 "general_operand" "fmG,f")))]
  494.   "TARGET_68881"
  495.   "*
  496. {
  497.   cc_status.flags = CC_IN_68881;
  498. #ifdef SGS_CMP_ORDER
  499.   if (REG_P (operands[0]))
  500.     {
  501.       if (REG_P (operands[1]))
  502.     return \"fcmp%.x %0,%1\";
  503.       else
  504.         return \"fcmp%.d %0,%f1\";
  505.     }
  506.   cc_status.flags |= CC_REVERSED;
  507.   return \"fcmp%.d %1,%f0\";
  508. #else
  509.   if (REG_P (operands[0]))
  510.     {
  511.       if (REG_P (operands[1]))
  512.     return \"fcmp%.x %1,%0\";
  513.       else
  514.         return \"fcmp%.d %f1,%0\";
  515.     }
  516.   cc_status.flags |= CC_REVERSED;
  517.   return \"fcmp%.d %f0,%1\";
  518. #endif
  519. }")
  520.  
  521. (define_expand "cmpsf"
  522.  [(set (cc0)
  523.        (compare (match_operand:SF 0 "general_operand" "")
  524.         (match_operand:SF 1 "general_operand" "")))]
  525.  "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  526.  "
  527. {
  528.   if (TARGET_FPA)
  529.     {
  530.       emit_insn (gen_cmpsf_fpa (operands[0], operands[1]));
  531.       DONE;
  532.     }
  533. }")
  534.  
  535. (define_insn "cmpsf_fpa"
  536.   [(set (cc0)
  537.     (compare (match_operand:SF 0 "general_operand" "x,y")
  538.          (match_operand:SF 1 "general_operand" "xH,rmF")))
  539.    (clobber (match_scratch:SI 2 "=d,d"))]
  540.   "TARGET_FPA"
  541.   "fpcmp%.s %w1,%x0\;fpmove fpastatus,%2\;movw %2,cc")
  542.  
  543. (define_insn ""
  544.   [(set (cc0)
  545.     (compare (match_operand:SF 0 "general_operand" "f,mdG")
  546.          (match_operand:SF 1 "general_operand" "fmdG,f")))]
  547.   "TARGET_68881"
  548.   "*
  549. {
  550.   cc_status.flags = CC_IN_68881;
  551. #ifdef SGS_CMP_ORDER
  552.   if (FP_REG_P (operands[0]))
  553.     {
  554.       if (FP_REG_P (operands[1]))
  555.     return \"fcmp%.x %0,%1\";
  556.       else
  557.         return \"fcmp%.s %0,%f1\";
  558.     }
  559.   cc_status.flags |= CC_REVERSED;
  560.   return \"fcmp%.s %1,%f0\";
  561. #else
  562.   if (FP_REG_P (operands[0]))
  563.     {
  564.       if (FP_REG_P (operands[1]))
  565.     return \"fcmp%.x %1,%0\";
  566.       else
  567.         return \"fcmp%.s %f1,%0\";
  568.     }
  569.   cc_status.flags |= CC_REVERSED;
  570.   return \"fcmp%.s %f0,%1\";
  571. #endif
  572. }")
  573.  
  574. ;; Recognizers for btst instructions.
  575.  
  576. (define_insn ""
  577.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do")
  578.                 (const_int 1)
  579.                 (minus:SI (const_int 7)
  580.                       (match_operand:SI 1 "general_operand" "di"))))]
  581.   ""
  582.   "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
  583.  
  584. (define_insn ""
  585.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d")
  586.                 (const_int 1)
  587.                 (minus:SI (const_int 31)
  588.                       (match_operand:SI 1 "general_operand" "di"))))]
  589.   ""
  590.   "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
  591.  
  592. ;; The following two patterns are like the previous two
  593. ;; except that they use the fact that bit-number operands
  594. ;; are automatically masked to 3 or 5 bits.
  595.  
  596. (define_insn ""
  597.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do")
  598.                 (const_int 1)
  599.                 (minus:SI (const_int 7)
  600.                       (and:SI
  601.                        (match_operand:SI 1 "general_operand" "d")
  602.                        (const_int 7)))))]
  603.   ""
  604.   "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
  605.  
  606. (define_insn ""
  607.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d")
  608.                 (const_int 1)
  609.                 (minus:SI (const_int 31)
  610.                       (and:SI
  611.                        (match_operand:SI 1 "general_operand" "d")
  612.                        (const_int 31)))))]
  613.   ""
  614.   "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
  615.  
  616. ;; Nonoffsettable mem refs are ok in this one pattern
  617. ;; since we don't try to adjust them.
  618. (define_insn ""
  619.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "md")
  620.                 (const_int 1)
  621.                 (match_operand:SI 1 "general_operand" "i")))]
  622.   "GET_CODE (operands[1]) == CONST_INT
  623.    && (unsigned) INTVAL (operands[1]) < 8"
  624.   "*
  625. {
  626.   operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - INTVAL (operands[1]));
  627.   return output_btst (operands, operands[1], operands[0], insn, 7);
  628. }")
  629.  
  630. (define_insn ""
  631.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "do")
  632.                 (const_int 1)
  633.                 (match_operand:SI 1 "general_operand" "i")))]
  634.   "GET_CODE (operands[1]) == CONST_INT"
  635.   "*
  636. {
  637.   if (GET_CODE (operands[0]) == MEM)
  638.     {
  639.       operands[0] = adj_offsettable_operand (operands[0],
  640.                          INTVAL (operands[1]) / 8);
  641.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  642.                  7 - INTVAL (operands[1]) % 8);
  643.       return output_btst (operands, operands[1], operands[0], insn, 7);
  644.     }
  645.   operands[1] = gen_rtx (CONST_INT, VOIDmode,
  646.              31 - INTVAL (operands[1]));
  647.   return output_btst (operands, operands[1], operands[0], insn, 31);
  648. }")
  649.  
  650.  
  651. ;; move instructions
  652.  
  653. ;; A special case in which it is not desirable
  654. ;; to reload the constant into a data register.
  655. (define_insn ""
  656.   [(set (match_operand:SI 0 "push_operand" "=m")
  657.     (match_operand:SI 1 "general_operand" "J"))]
  658.   "GET_CODE (operands[1]) == CONST_INT
  659.    && INTVAL (operands[1]) >= -0x8000
  660.    && INTVAL (operands[1]) < 0x8000"
  661.   "*
  662. {
  663.   if (operands[1] == const0_rtx)
  664.     return \"clr%.l %0\";
  665.   return \"pea %a1\";
  666. }")
  667.  
  668. ;This is never used.
  669. ;(define_insn "swapsi"
  670. ;  [(set (match_operand:SI 0 "general_operand" "+r")
  671. ;    (match_operand:SI 1 "general_operand" "+r"))
  672. ;   (set (match_dup 1) (match_dup 0))]
  673. ;  ""
  674. ;  "exg %1,%0")
  675.  
  676. ;; Special case of fullword move when source is zero.
  677. ;; The reason this is special is to avoid loading a zero
  678. ;; into a data reg with moveq in order to store it elsewhere.
  679.    
  680. (define_insn ""
  681.   [(set (match_operand:SI 0 "general_operand" "=g")
  682.     (const_int 0))]
  683.   ;; clr insns on 68000 read before writing.
  684.   ;; This isn't so on the 68010, but we have no alternative for it.
  685.   "(TARGET_68020
  686.     || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))"
  687.   "*
  688. {
  689.   if (ADDRESS_REG_P (operands[0]))
  690.     return \"sub%.l %0,%0\";
  691.   /* moveq is faster on the 68000.  */
  692.   if (DATA_REG_P (operands[0]) && !TARGET_68020)
  693. #if defined(MOTOROLA) && !defined(CRDS)
  694.     return \"moveq%.l %#0,%0\";
  695. #else
  696.     return \"moveq %#0,%0\";
  697. #endif
  698.   return \"clr%.l %0\";
  699. }")
  700.  
  701. ;; General case of fullword move. 
  702. ;;
  703. ;; This is the main "hook" for PIC code.  When generating
  704. ;; PIC, movsi is responsible for determining when the source address
  705. ;; needs PIC relocation and appropriately calling legitimize_pic_address
  706. ;; to perform the actual relocation.
  707. ;;
  708. ;; In both the PIC and non-PIC cases the patterns generated will
  709. ;; matched by the next define_insn. 
  710. (define_expand "movsi"
  711.   [(set (match_operand:SI 0 "general_operand" "")
  712.     (match_operand:SI 1 "general_operand" ""))]
  713.   ""
  714.   "
  715. {
  716.   if (flag_pic && symbolic_operand (operands[1], SImode)) 
  717.     {
  718.       /* The source is an address which requires PIC relocation.  
  719.          Call legitimize_pic_address with the source, mode, and a relocation
  720.          register (a new pseudo, or the final destination if reload_in_progress
  721.          is set).   Then fall through normally */
  722.       extern rtx legitimize_pic_address();
  723.       rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
  724.       operands[1] = legitimize_pic_address (operands[1], SImode, temp);
  725.     }
  726. }")
  727.  
  728. ;; General case of fullword move.  The register constraints
  729. ;; force integer constants in range for a moveq to be reloaded
  730. ;; if they are headed for memory.
  731. (define_insn ""
  732.   ;; Notes: make sure no alternative allows g vs g.
  733.   ;; We don't allow f-regs since fixed point cannot go in them.
  734.   ;; We do allow y and x regs since fixed point is allowed in them.
  735.   [(set (match_operand:SI 0 "general_operand" "=g,da,y,!*x*r*m")
  736.     (match_operand:SI 1 "general_operand" "daymKs,i,g,*x*r*m"))]
  737.   ""
  738.   "*
  739. {
  740.   if (which_alternative == 3)
  741.     return \"fpmove%.l %x1,fpa0\;fpmove%.l fpa0,%x0\";    
  742.   if (FPA_REG_P (operands[1]) || FPA_REG_P (operands[0]))
  743.     return \"fpmove%.l %x1,%x0\";
  744.   if (GET_CODE (operands[1]) == CONST_INT)
  745.     {
  746.       if (operands[1] == const0_rtx
  747.       && (DATA_REG_P (operands[0])
  748.           || GET_CODE (operands[0]) == MEM)
  749.       /* clr insns on 68000 read before writing.
  750.          This isn't so on the 68010, but we have no alternative for it.  */
  751.       && (TARGET_68020
  752.           || !(GET_CODE (operands[0]) == MEM
  753.            && MEM_VOLATILE_P (operands[0]))))
  754.     return \"clr%.l %0\";
  755.       else if (DATA_REG_P (operands[0])
  756.            && INTVAL (operands[1]) < 128
  757.            && INTVAL (operands[1]) >= -128)
  758.         {
  759. #if defined(MOTOROLA) && !defined(CRDS)
  760.           return \"moveq%.l %1,%0\";
  761. #else
  762.       return \"moveq %1,%0\";
  763. #endif
  764.     }
  765. #ifndef NO_ADDSUB_Q
  766.       else if (DATA_REG_P (operands[0])
  767.            /* Do this with a moveq #N-8, dreg; addq #8,dreg */
  768.            && INTVAL (operands[1]) < 136
  769.            && INTVAL (operands[1]) >= 128)
  770.         {
  771.       operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) - 8);
  772. #if defined(MOTOROLA) && !defined(CRDS)
  773.           return \"moveq%.l %1,%0\;addq%.w %#8,%0\";
  774. #else
  775.       return \"moveq %1,%0\;addq%.w %#8,%0\";
  776. #endif
  777.     }
  778.       else if (DATA_REG_P (operands[0])
  779.            /* Do this with a moveq #N+8, dreg; subq #8,dreg */
  780.            && INTVAL (operands[1]) < -128
  781.            && INTVAL (operands[1]) >= -136)
  782.         {
  783.       operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) + 8);
  784. #if defined(MOTOROLA) && !defined(CRDS)
  785.           return \"moveq%.l %1,%0;subq%.w %#8,%0\";
  786. #else
  787.       return \"moveq %1,%0;subq%.w %#8,%0\";
  788. #endif
  789.     }
  790. #endif
  791.       else if (DATA_REG_P (operands[0])
  792.            /* If N is in the right range and is even, then use
  793.               moveq #N/2, dreg; addl dreg,dreg */
  794.            && INTVAL (operands[1]) > 127
  795.            && INTVAL (operands[1]) <= 254
  796.            && INTVAL (operands[1]) % 2 == 0)
  797.         {
  798.       operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) / 2);
  799. #if defined(MOTOROLA) && !defined(CRDS)
  800.           return \"moveq%.l %1,%0\;add%.w %0,%0\";
  801. #else
  802.       return \"moveq %1,%0\;add%.w %0,%0\";
  803. #endif
  804.     }
  805.       else if (ADDRESS_REG_P (operands[0])
  806.            && INTVAL (operands[1]) < 0x8000
  807.            && INTVAL (operands[1]) >= -0x8000)
  808.     return \"move%.w %1,%0\";
  809.       else if (push_operand (operands[0], SImode)
  810.            && INTVAL (operands[1]) < 0x8000
  811.            && INTVAL (operands[1]) >= -0x8000)
  812.         return \"pea %a1\";
  813.     }
  814.   else if ((GET_CODE (operands[1]) == SYMBOL_REF
  815.         || GET_CODE (operands[1]) == CONST)
  816.        && push_operand (operands[0], SImode))
  817.     return \"pea %a1\";
  818.   else if (GET_CODE (operands[1]) == SYMBOL_REF
  819.         || GET_CODE (operands[1]) == CONST) {
  820.     if (ADDRESS_REG_P (operands[0])) {
  821.        return \"lea %a1,%0\";
  822.      } else {
  823.        return \"pea %a1\;move.l (sp)+,%0\";
  824.      }
  825.   }
  826.   return \"move%.l %1,%0\";
  827. }")
  828.  
  829. (define_insn "movhi"
  830.   [(set (match_operand:HI 0 "general_operand" "=g")
  831.     (match_operand:HI 1 "general_operand" "g"))]
  832.   ""
  833.   "*
  834. {
  835.   if (GET_CODE (operands[1]) == CONST_INT)
  836.     {
  837.       if (operands[1] == const0_rtx
  838.       && (DATA_REG_P (operands[0])
  839.           || GET_CODE (operands[0]) == MEM)
  840.       /* clr insns on 68000 read before writing.
  841.          This isn't so on the 68010, but we have no alternative for it.  */
  842.       && (TARGET_68020
  843.           || !(GET_CODE (operands[0]) == MEM
  844.            && MEM_VOLATILE_P (operands[0]))))
  845.     return \"clr%.w %0\";
  846.       else if (DATA_REG_P (operands[0])
  847.            && INTVAL (operands[1]) < 128
  848.            && INTVAL (operands[1]) >= -128)
  849.         {
  850. #if defined(MOTOROLA) && !defined(CRDS)
  851.           return \"moveq%.l %1,%0\";
  852. #else
  853.       return \"moveq %1,%0\";
  854. #endif
  855.     }
  856.       else if (INTVAL (operands[1]) < 0x8000
  857.            && INTVAL (operands[1]) >= -0x8000)
  858.     return \"move%.w %1,%0\";
  859.     }
  860.   else if (CONSTANT_P (operands[1]))
  861.     return \"move%.l %1,%0\";
  862. #ifndef SGS_NO_LI
  863.   /* Recognize the insn before a tablejump, one that refers
  864.      to a table of offsets.  Such an insn will need to refer
  865.      to a label on the insn.  So output one.  Use the label-number
  866.      of the table of offsets to generate this label.  */
  867.   if (GET_CODE (operands[1]) == MEM
  868.       && GET_CODE (XEXP (operands[1], 0)) == PLUS
  869.       && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
  870.       || GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == LABEL_REF)
  871.       && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS
  872.       && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) != PLUS)
  873.     {
  874.       rtx labelref;
  875.       if (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF)
  876.     labelref = XEXP (XEXP (operands[1], 0), 0);
  877.       else
  878.     labelref = XEXP (XEXP (operands[1], 0), 1);
  879. #ifndef MPW_ASM
  880. #if defined (MOTOROLA) && !defined (SGS_SWITCH_TABLES)
  881. #ifdef SGS
  882.       asm_fprintf (asm_out_file, \"\\tset %LLI%d,.+2\\n\",
  883.            CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  884. #else /* not SGS */
  885.       asm_fprintf (asm_out_file, \"\\t.set %LLI%d,.+2\\n\",
  886.                CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  887. #endif /* not SGS */
  888. #else /* SGS_SWITCH_TABLES or not MOTOROLA */
  889.       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\",
  890.                  CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  891. #ifdef SGS_SWITCH_TABLES
  892.       /* Set flag saying we need to define the symbol
  893.      LD%n (with value L%n-LI%n) at the end of the switch table.  */
  894.       switch_table_difference_label_flag = 1;
  895. #endif /* SGS_SWITCH_TABLES */
  896. #endif /* SGS_SWITCH_TABLES or not MOTOROLA */
  897. #endif /* n MPW_ASM */
  898.     }
  899. #endif /* SGS_NO_LI */
  900.   return \"move%.w %1,%0\";
  901. }")
  902.  
  903. (define_insn "movstricthi"
  904.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  905.     (match_operand:HI 1 "general_operand" "rmn"))]
  906.   ""
  907.   "*
  908. {
  909.   if (GET_CODE (operands[1]) == CONST_INT)
  910.     {
  911.       if (operands[1] == const0_rtx
  912.       && (DATA_REG_P (operands[0])
  913.           || GET_CODE (operands[0]) == MEM)
  914.       /* clr insns on 68000 read before writing.
  915.          This isn't so on the 68010, but we have no alternative for it.  */
  916.       && (TARGET_68020
  917.           || !(GET_CODE (operands[0]) == MEM
  918.            && MEM_VOLATILE_P (operands[0]))))
  919.     return \"clr%.w %0\";
  920.     }
  921.   return \"move%.w %1,%0\";
  922. }")
  923.  
  924. (define_insn "movqi"
  925.   [(set (match_operand:QI 0 "general_operand" "=d,*a,m,m,?*a")
  926.     (match_operand:QI 1 "general_operand" "dmi*a,d*a,dmi,?*a,m"))]
  927.   ""
  928.   "*
  929. {
  930.   rtx xoperands[4];
  931.  
  932.   /* This is probably useless, since it loses for pushing a struct
  933.      of several bytes a byte at a time.  */
  934.   if (GET_CODE (operands[0]) == MEM
  935.       && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
  936.       && XEXP (XEXP (operands[0], 0), 0) == stack_pointer_rtx)
  937.     {
  938.       xoperands[1] = operands[1];
  939.       xoperands[2]
  940.         = gen_rtx (MEM, QImode,
  941.            gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
  942.       xoperands[3] = stack_pointer_rtx;
  943.       /* Just pushing a byte puts it in the high byte of the halfword.  */
  944.       /* We must put it in the low-order, high-numbered byte.  */
  945.       output_asm_insn (\"subq%.w %#2,%3\;move%.b %1,%2\", xoperands);
  946.       return \"\";
  947.     }
  948.  
  949.   if (ADDRESS_REG_P (operands[0]) && GET_CODE (operands[1]) == MEM)
  950.     {
  951.       xoperands[1] = operands[1];
  952.       xoperands[2]
  953.         = gen_rtx (MEM, QImode,
  954.            gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
  955.       xoperands[3] = stack_pointer_rtx;
  956.       /* Just pushing a byte puts it in the high byte of the halfword.  */
  957.       /* We must put it in the low half, the second byte.  */
  958.       output_asm_insn (\"subq%.w %#2,%3\;move%.b %1,%2\", xoperands);
  959.       return \"move%.w %+,%0\";
  960.     }
  961.   if (ADDRESS_REG_P (operands[1]) && GET_CODE (operands[0]) == MEM)
  962.     {
  963.       xoperands[0] = operands[0];
  964.       xoperands[1] = operands[1];
  965.       xoperands[2]
  966.         = gen_rtx (MEM, QImode,
  967.            gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
  968.       xoperands[3] = stack_pointer_rtx;
  969.       output_asm_insn (\"move%.w %1,%-\;move%.b %2,%0\;addq%.w %#2,%3\", xoperands);
  970.       return \"\";
  971.     }
  972.   /* clr and st insns on 68000 read before writing.
  973.      This isn't so on the 68010, but we have no alternative for it.  */
  974.   if (TARGET_68020
  975.       || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))
  976.     {
  977.       if (operands[1] == const0_rtx)
  978.     return \"clr%.b %0\";
  979.       if (GET_CODE (operands[1]) == CONST_INT
  980.       && INTVAL (operands[1]) == -1)
  981.     {
  982.       CC_STATUS_INIT;
  983.       return \"st %0\";
  984.     }
  985.     }
  986.   if (GET_CODE (operands[1]) != CONST_INT && CONSTANT_P (operands[1]))
  987.     return \"move%.l %1,%0\";
  988.   if (ADDRESS_REG_P (operands[0]) || ADDRESS_REG_P (operands[1]))
  989.     return \"move%.w %1,%0\";
  990.   return \"move%.b %1,%0\";
  991. }")
  992.  
  993. (define_insn "movstrictqi"
  994.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  995.     (match_operand:QI 1 "general_operand" "dmn"))]
  996.   ""
  997.   "*
  998. {
  999.   if (operands[1] == const0_rtx
  1000.       /* clr insns on 68000 read before writing.
  1001.          This isn't so on the 68010, but we have no alternative for it.  */
  1002.       && (TARGET_68020
  1003.           || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
  1004.     return \"clr%.b %0\";
  1005.   return \"move%.b %1,%0\";
  1006. }")
  1007.  
  1008. (define_insn "movsf"
  1009.   [(set (match_operand:SF 0 "general_operand" "=rmf,x,y,rm,!x,!rm")
  1010.     (match_operand:SF 1 "general_operand" "rmfF,xH,rmF,y,rm,x"))]
  1011. ;  [(set (match_operand:SF 0 "general_operand" "=rmf")
  1012. ;    (match_operand:SF 1 "general_operand" "rmfF"))]
  1013.   ""
  1014.   "*
  1015. {
  1016.   if (which_alternative >= 4)
  1017.     return \"fpmove%.s %1,fpa0\;fpmove%.s fpa0,%0\";
  1018.   if (FPA_REG_P (operands[0]))
  1019.     {
  1020.       if (FPA_REG_P (operands[1]))
  1021.     return \"fpmove%.s %x1,%x0\";
  1022.       else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1023.     return output_move_const_single (operands);
  1024.       else if (FP_REG_P (operands[1]))
  1025.         return \"fmove%.s %1,sp@-\;fpmove%.d sp@+, %0\";
  1026.       return \"fpmove%.s %x1,%x0\";
  1027.     }
  1028.   if (FPA_REG_P (operands[1]))
  1029.     {
  1030.       if (FP_REG_P (operands[0]))
  1031.     return \"fpmove%.s %x1,sp@-\;fmove%.s sp@+,%0\";
  1032.       else
  1033.     return \"fpmove%.s %x1,%x0\";
  1034.     }
  1035.   if (FP_REG_P (operands[0]))
  1036.     {
  1037.       if (FP_REG_P (operands[1]))
  1038.     return \"f%$move%.x %1,%0\";
  1039.       else if (ADDRESS_REG_P (operands[1]))
  1040.     return \"move%.l %1,%-\;f%$move%.s %+,%0\";
  1041.       else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1042.     return output_move_const_single (operands);
  1043.       return \"f%$move%.s %f1,%0\";
  1044.     }
  1045.   if (FP_REG_P (operands[1]))
  1046.     {
  1047.       if (ADDRESS_REG_P (operands[0]))
  1048.     return \"fmove%.s %1,%-\;move%.l %+,%0\";
  1049.       return \"fmove%.s %f1,%0\";
  1050.     }
  1051.   return \"move%.l %1,%0\";
  1052. }")
  1053.  
  1054. (define_insn "movdf"
  1055. ;  [(set (match_operand:DF 0 "general_operand" "=rm,&rf,&rof<>,y,rm,x,!x,!rm")
  1056. ;    (match_operand:DF 1 "general_operand" "rf,m,rofE<>,rmE,y,xH,rm,x"))]
  1057. ;  [(set (match_operand:DF 0 "general_operand" "=rm,&rf,&rof<>")
  1058. ;    (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
  1059.   [(set (match_operand:DF 0 "general_operand" "=&ro<>f,&rf")
  1060.     (match_operand:DF 1 "general_operand" "ro<>fF,m"))]
  1061.   ""
  1062.   "*
  1063. {
  1064.   if (which_alternative == 6)
  1065.     return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
  1066.   if (FPA_REG_P (operands[0]))
  1067.     {
  1068.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1069.     return output_move_const_double (operands);
  1070.       if (FP_REG_P (operands[1]))
  1071.         return \"fmove%.d %1,sp@-\;fpmove%.d sp@+,%x0\";
  1072.       return \"fpmove%.d %x1,%x0\";
  1073.     }
  1074.   else if (FPA_REG_P (operands[1]))
  1075.     {
  1076.       if (FP_REG_P(operands[0]))
  1077.         return \"fpmove%.d %x1,sp@-\;fmoved sp@+,%0\";
  1078.       else
  1079.         return \"fpmove%.d %x1,%x0\";
  1080.     }
  1081.   if (FP_REG_P (operands[0]))
  1082.     {
  1083.       if (FP_REG_P (operands[1]))
  1084.     return \"f%&move%.x %1,%0\";
  1085.       if (REG_P (operands[1]))
  1086.     {
  1087.       rtx xoperands[2];
  1088.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  1089.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  1090.       output_asm_insn (\"move%.l %1,%-\", operands);
  1091.       return \"f%&move%.d %+,%0\";
  1092.     }
  1093.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1094.     return output_move_const_double (operands);
  1095.       return \"f%&move%.d %f1,%0\";
  1096.     }
  1097.   else if (FP_REG_P (operands[1]))
  1098.     {
  1099.       if (REG_P (operands[0]))
  1100.     {
  1101.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  1102.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1103.       return \"move%.l %+,%0\";
  1104.     }
  1105.       else
  1106.         return \"fmove%.d %f1,%0\";
  1107.     }
  1108.   return output_move_double (operands);
  1109. }
  1110. ")
  1111.  
  1112. ;; movdi can apply to fp regs in some cases
  1113. (define_insn "movdi"
  1114.   ;; Let's see if it really still needs to handle fp regs, and, if so, why.
  1115. ;  [(set (match_operand:DI 0 "general_operand" "=rm,&r,&ro<>,!&rm,!&f,y,rm,x,!x,!rm")
  1116. ;    (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfmF,rmi,y,rm,x"))]
  1117.   [(set (match_operand:DI 0 "general_operand" "=rm,&rf,&ro<>,!&rm,!&f")
  1118.     (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
  1119.   ""
  1120.   "*
  1121. {
  1122.   if (which_alternative == 8)
  1123.     return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
  1124.   if (FPA_REG_P (operands[0]) || FPA_REG_P (operands[1]))
  1125.     return \"fpmove%.d %x1,%x0\";
  1126.   if (FP_REG_P (operands[0]))
  1127.     {
  1128.       if (FP_REG_P (operands[1]))
  1129.     return \"fmove%.x %1,%0\";
  1130.       if (REG_P (operands[1]))
  1131.     {
  1132.       rtx xoperands[2];
  1133.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  1134.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  1135.       output_asm_insn (\"move%.l %1,%-\", operands);
  1136.       return \"fmove%.d %+,%0\";
  1137.     }
  1138.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1139.     return output_move_const_double (operands);
  1140.       return \"fmove%.d %f1,%0\";
  1141.     }
  1142.   else if (FP_REG_P (operands[1]))
  1143.     {
  1144.       if (REG_P (operands[0]))
  1145.     {
  1146.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  1147.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1148.       return \"move%.l %+,%0\";
  1149.     }
  1150.       else
  1151.         return \"fmove%.d %f1,%0\";
  1152.     }
  1153.   return output_move_double (operands);
  1154. }
  1155. ")
  1156.  
  1157. ;; Thus goes after the move instructions
  1158. ;; because the move instructions are better (require no spilling)
  1159. ;; when they can apply.  It goes before the add/sub insns
  1160. ;; so we will prefer it to them.
  1161.  
  1162. (define_insn "pushasi"
  1163.   [(set (match_operand:SI 0 "push_operand" "=m")
  1164.     (match_operand:SI 1 "address_operand" "p"))]
  1165.   ""
  1166.   "pea %a1")
  1167.  
  1168. ;; truncation instructions
  1169. (define_insn "truncsiqi2"
  1170.   [(set (match_operand:QI 0 "general_operand" "=dm,d")
  1171.     (truncate:QI
  1172.      (match_operand:SI 1 "general_operand" "doJ,i")))]
  1173.   ""
  1174.   "*
  1175. {
  1176.   if (GET_CODE (operands[0]) == REG)
  1177.     {
  1178.       /* Must clear condition codes, since the move.l bases them on
  1179.      the entire 32 bits, not just the desired 8 bits.  */
  1180.       CC_STATUS_INIT;
  1181.       return \"move%.l %1,%0\";
  1182.     }
  1183.   if (GET_CODE (operands[1]) == MEM)
  1184.     operands[1] = adj_offsettable_operand (operands[1], 3);
  1185.   return \"move%.b %1,%0\";
  1186. }")
  1187.  
  1188. (define_insn "trunchiqi2"
  1189.   [(set (match_operand:QI 0 "general_operand" "=dm,d")
  1190.     (truncate:QI
  1191.      (match_operand:HI 1 "general_operand" "doJ,i")))]
  1192.   ""
  1193.   "*
  1194. {
  1195.   if (GET_CODE (operands[0]) == REG
  1196.       && (GET_CODE (operands[1]) == MEM
  1197.       || GET_CODE (operands[1]) == CONST_INT))
  1198.     {
  1199.       /* Must clear condition codes, since the move.w bases them on
  1200.      the entire 16 bits, not just the desired 8 bits.  */
  1201.       CC_STATUS_INIT;
  1202.       return \"move%.w %1,%0\";
  1203.     }
  1204.   if (GET_CODE (operands[0]) == REG)
  1205.     {
  1206.       /* Must clear condition codes, since the move.l bases them on
  1207.      the entire 32 bits, not just the desired 8 bits.  */
  1208.       CC_STATUS_INIT;
  1209.       return \"move%.l %1,%0\";
  1210.     }
  1211.   if (GET_CODE (operands[1]) == MEM)
  1212.     operands[1] = adj_offsettable_operand (operands[1], 1);
  1213.   return \"move%.b %1,%0\";
  1214. }")
  1215.  
  1216. (define_insn "truncsihi2"
  1217.   [(set (match_operand:HI 0 "general_operand" "=dm,d")
  1218.     (truncate:HI
  1219.      (match_operand:SI 1 "general_operand" "roJ,i")))]
  1220.   ""
  1221.   "*
  1222. {
  1223.   if (GET_CODE (operands[0]) == REG)
  1224.     {
  1225.       /* Must clear condition codes, since the move.l bases them on
  1226.      the entire 32 bits, not just the desired 8 bits.  */
  1227.       CC_STATUS_INIT;
  1228.       return \"move%.l %1,%0\";
  1229.     }
  1230.   if (GET_CODE (operands[1]) == MEM)
  1231.     operands[1] = adj_offsettable_operand (operands[1], 2);
  1232.   return \"move%.w %1,%0\";
  1233. }")
  1234.  
  1235. ;; zero extension instructions
  1236.  
  1237. (define_expand "zero_extendhisi2"
  1238.   [(set (match_operand:SI 0 "register_operand" "")
  1239.     (const_int 0))
  1240.    (set (strict_low_part (match_dup 2))
  1241.     (match_operand:HI 1 "general_operand" ""))]
  1242.   ""
  1243.   "
  1244. {
  1245.   operands[1] = make_safe_from (operands[1], operands[0]);
  1246.   if (GET_CODE (operands[0]) == SUBREG)
  1247.     operands[2] = gen_rtx (SUBREG, HImode, SUBREG_REG (operands[0]),
  1248.                SUBREG_WORD (operands[0]));
  1249.   else
  1250.     operands[2] = gen_rtx (SUBREG, HImode, operands[0], 0);
  1251. }")
  1252.  
  1253. (define_expand "zero_extendqihi2"
  1254.   [(set (match_operand:HI 0 "register_operand" "")
  1255.     (const_int 0))
  1256.    (set (strict_low_part (match_dup 2))
  1257.     (match_operand:QI 1 "general_operand" ""))]
  1258.   ""
  1259.   "
  1260. {
  1261.   operands[1] = make_safe_from (operands[1], operands[0]);
  1262.   if (GET_CODE (operands[0]) == SUBREG)
  1263.     operands[2] = gen_rtx (SUBREG, QImode, SUBREG_REG (operands[0]),
  1264.                SUBREG_WORD (operands[0]));
  1265.   else
  1266.     operands[2] = gen_rtx (SUBREG, QImode, operands[0], 0);
  1267. }")
  1268.  
  1269. (define_expand "zero_extendqisi2"
  1270.   [(set (match_operand:SI 0 "register_operand" "")
  1271.     (const_int 0))
  1272.    (set (strict_low_part (match_dup 2))
  1273.     (match_operand:QI 1 "general_operand" ""))]
  1274.   ""
  1275.   "
  1276. {
  1277.   operands[1] = make_safe_from (operands[1], operands[0]);
  1278.   if (GET_CODE (operands[0]) == SUBREG)
  1279.     operands[2] = gen_rtx (SUBREG, QImode, SUBREG_REG (operands[0]),
  1280.                SUBREG_WORD (operands[0]));
  1281.   else
  1282.     operands[2] = gen_rtx (SUBREG, QImode, operands[0], 0);
  1283. }")
  1284.  
  1285. ;; Patterns to recognize zero-extend insns produced by the combiner.
  1286. ;; We don't allow both operands in memory, because of aliasing problems.
  1287. ;; Explicitly disallow two memory operands via the condition since reloading
  1288. ;; of this case will result in worse code than the uncombined patterns.
  1289.  
  1290. (define_insn ""
  1291.   [(set (match_operand:SI 0 "general_operand" "=do<>,d<")
  1292.     (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
  1293.   "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
  1294.   "*
  1295. {
  1296.   if (DATA_REG_P (operands[0]))
  1297.     {
  1298.       if (GET_CODE (operands[1]) == REG
  1299.       && REGNO (operands[0]) == REGNO (operands[1]))
  1300. #ifdef MPW_ASM
  1301.     return \"and%.l %#$FFFF,%0\";
  1302. #else
  1303.     return \"and%.l %#0xFFFF,%0\";
  1304. #endif
  1305.       if (reg_mentioned_p (operands[0], operands[1]))
  1306. #ifdef MPW_ASM
  1307.         return \"move%.w %1,%0\;and%.l %#$FFFF,%0\";
  1308. #else
  1309.         return \"move%.w %1,%0\;and%.l %#0xFFFF,%0\";
  1310. #endif
  1311.       return \"clr%.l %0\;move%.w %1,%0\";
  1312.     }
  1313.   else if (GET_CODE (operands[0]) == MEM
  1314.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  1315.     return \"move%.w %1,%0\;clr%.w %0\";
  1316.   else if (GET_CODE (operands[0]) == MEM
  1317.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  1318.     return \"clr%.w %0\;move%.w %1,%0\";
  1319.   else
  1320.     {
  1321.       output_asm_insn (\"clr%.w %0\", operands);
  1322.       operands[0] = adj_offsettable_operand (operands[0], 2);
  1323.       return \"move%.w %1,%0\";
  1324.     }
  1325. }")
  1326.  
  1327. (define_insn ""
  1328.   [(set (match_operand:HI 0 "general_operand" "=do<>,d")
  1329.     (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
  1330.   "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
  1331.   "*
  1332. {
  1333.   if (DATA_REG_P (operands[0]))
  1334.     {
  1335.       if (GET_CODE (operands[1]) == REG
  1336.       && REGNO (operands[0]) == REGNO (operands[1]))
  1337. #ifdef MPW_ASM
  1338.     return \"and%.w %#$FF,%0\";
  1339. #else
  1340.     return \"and%.w %#0xFF,%0\";
  1341. #endif
  1342.       if (reg_mentioned_p (operands[0], operands[1]))
  1343. #ifdef MPW_ASM
  1344.         return \"move%.b %1,%0\;and%.w %#$FF,%0\";
  1345. #else
  1346.         return \"move%.b %1,%0\;and%.w %#0xFF,%0\";
  1347. #endif
  1348.       return \"clr%.w %0\;move%.b %1,%0\";
  1349.     }
  1350.   else if (GET_CODE (operands[0]) == MEM
  1351.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  1352.     {
  1353.       if (REGNO (XEXP (XEXP (operands[0], 0), 0))
  1354.       == STACK_POINTER_REGNUM)
  1355.     {
  1356.       output_asm_insn (\"clr%.w %-\", operands);
  1357.       operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  1358.                  plus_constant (stack_pointer_rtx, 1));
  1359.       return \"move%.b %1,%0\";
  1360.     }
  1361.       else
  1362.     return \"move%.b %1,%0\;clr%.b %0\";
  1363.     }
  1364.   else if (GET_CODE (operands[0]) == MEM
  1365.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  1366.     return \"clr%.b %0\;move%.b %1,%0\";
  1367.   else
  1368.     {
  1369.       output_asm_insn (\"clr%.b %0\", operands);
  1370.       operands[0] = adj_offsettable_operand (operands[0], 1);
  1371.       return \"move%.b %1,%0\";
  1372.     }
  1373. }")
  1374.  
  1375. (define_insn ""
  1376.   [(set (match_operand:SI 0 "general_operand" "=do<>,d")
  1377.     (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
  1378.   "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
  1379.   "*
  1380. {
  1381.   if (DATA_REG_P (operands[0]))
  1382.     {
  1383.       if (GET_CODE (operands[1]) == REG
  1384.       && REGNO (operands[0]) == REGNO (operands[1]))
  1385. #ifdef MPW_ASM
  1386.     return \"and%.l %#$FF,%0\";
  1387. #else
  1388.     return \"and%.l %#0xFF,%0\";
  1389. #endif
  1390.       if (reg_mentioned_p (operands[0], operands[1]))
  1391. #ifdef MPW_ASM
  1392.         return \"move%.b %1,%0\;and%.l %#$FF,%0\";
  1393. #else
  1394.         return \"move%.b %1,%0\;and%.l %#0xFF,%0\";
  1395. #endif
  1396.       return \"clr%.l %0\;move%.b %1,%0\";
  1397.     }
  1398.   else if (GET_CODE (operands[0]) == MEM
  1399.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  1400.     {
  1401.       operands[0] = XEXP (XEXP (operands[0], 0), 0);
  1402. #ifdef MOTOROLA
  1403. #ifdef SGS
  1404.       return \"clr%.l -(%0)\;move%.b %1,3(%0)\";
  1405. #else
  1406.       return \"clr%.l -(%0)\;move%.b %1,(3,%0)\";
  1407. #endif
  1408. #else
  1409.       return \"clrl %0@-\;moveb %1,%0@(3)\";
  1410. #endif
  1411.     }
  1412.   else if (GET_CODE (operands[0]) == MEM
  1413.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  1414.     {
  1415.       operands[0] = XEXP (XEXP (operands[0], 0), 0);
  1416. #ifdef MOTOROLA
  1417. #ifdef SGS
  1418.       return \"clr%.l (%0)+\;move%.b %1,-1(%0)\";
  1419. #else
  1420.       return \"clr%.l (%0)+\;move%.b %1,(-1,%0)\";
  1421. #endif
  1422. #else
  1423.       return \"clrl %0@+\;moveb %1,%0@(-1)\";
  1424. #endif
  1425.     }
  1426.   else
  1427.     {
  1428.       output_asm_insn (\"clr%.l %0\", operands);
  1429.       operands[0] = adj_offsettable_operand (operands[0], 3);
  1430.       return \"move%.b %1,%0\";
  1431.     }
  1432. }")
  1433.  
  1434. ;; sign extension instructions
  1435.  
  1436. (define_insn "extendhisi2"
  1437.   [(set (match_operand:SI 0 "general_operand" "=*d,a")
  1438.     (sign_extend:SI
  1439.      (match_operand:HI 1 "nonimmediate_operand" "0,rm")))]
  1440.   ""
  1441.   "*
  1442. {
  1443.   if (ADDRESS_REG_P (operands[0]))
  1444.     return \"move%.w %1,%0\";
  1445.   return \"ext%.l %0\";
  1446. }")
  1447.  
  1448. (define_insn "extendqihi2"
  1449.   [(set (match_operand:HI 0 "general_operand" "=d")
  1450.     (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
  1451.   ""
  1452.   "ext%.w %0")
  1453.  
  1454. (define_insn "extendqisi2"
  1455.   [(set (match_operand:SI 0 "general_operand" "=d")
  1456.     (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
  1457.   "TARGET_68020"
  1458.   "extb%.l %0")
  1459.  
  1460. ;; Conversions between float and double.
  1461.  
  1462. (define_expand "extendsfdf2"
  1463.   [(set (match_operand:DF 0 "general_operand" "")
  1464.     (float_extend:DF
  1465.      (match_operand:SF 1 "general_operand" "")))]
  1466.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  1467.   "")
  1468.  
  1469. (define_insn ""
  1470.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  1471.     (float_extend:DF
  1472.      (match_operand:SF 1 "general_operand" "xH,rmF")))]
  1473.   "TARGET_FPA"
  1474.   "fpstod %w1,%0")
  1475.  
  1476. (define_insn ""
  1477.   [(set (match_operand:DF 0 "general_operand" "=*fdm,f")
  1478.     (float_extend:DF
  1479.       (match_operand:SF 1 "general_operand" "f,dmF")))]
  1480.   "TARGET_68881"
  1481.   "*
  1482. {
  1483.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  1484.     {
  1485.       if (REGNO (operands[0]) == REGNO (operands[1]))
  1486.     {
  1487.       /* Extending float to double in an fp-reg is a no-op.
  1488.          NOTICE_UPDATE_CC has already assumed that the
  1489.          cc will be set.  So cancel what it did.  */
  1490.       cc_status = cc_prev_status;
  1491.       return \"\";
  1492.     }
  1493.       return \"f%&move%.x %1,%0\";
  1494.     }
  1495.   if (FP_REG_P (operands[0]))
  1496.     return \"f%&move%.s %f1,%0\";
  1497.   if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
  1498.     {
  1499.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  1500.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1501.       return \"move%.l %+,%0\";
  1502.     }
  1503.   return \"fmove%.d %f1,%0\";
  1504. }")
  1505.  
  1506. ;; This cannot output into an f-reg because there is no way to be
  1507. ;; sure of truncating in that case.
  1508. ;; But on the Sun FPA, we can be sure.
  1509. (define_expand "truncdfsf2"
  1510.   [(set (match_operand:SF 0 "general_operand" "")
  1511.     (float_truncate:SF
  1512.       (match_operand:DF 1 "general_operand" "")))]
  1513.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  1514.   "")
  1515.  
  1516. ;BHP - This may not need to be commented out
  1517. ;(define_insn ""
  1518. ;  [(set (match_operand:SF 0 "general_operand" "=x,y")
  1519. ;    (float_truncate:SF
  1520. ;      (match_operand:DF 1 "general_operand" "xH,rmF")))]
  1521. ;  "TARGET_FPA"
  1522. ;  "fpdtos %y1,%0")
  1523.  
  1524. ;; On the '040 we can truncate in a register accurately and easily.
  1525. (define_insn ""
  1526.   [(set (match_operand:SF 0 "general_operand" "=f")
  1527.     (float_truncate:SF
  1528.       (match_operand:DF 1 "general_operand" "fmG")))]
  1529.   "TARGET_68040_ONLY"
  1530.   "*
  1531. {
  1532.   if (FP_REG_P (operands[1]))
  1533.     return \"fsmove%.x %1,%0\";
  1534.   return \"fsmove%.d %f1,%0\";
  1535. }")
  1536.  
  1537. (define_insn ""
  1538.   [(set (match_operand:SF 0 "general_operand" "=dm")
  1539.     (float_truncate:SF
  1540.       (match_operand:DF 1 "general_operand" "f")))]
  1541.   "TARGET_68881"
  1542.   "fmove%.s %f1,%0")
  1543.  
  1544.  
  1545. ;; Conversion between fixed point and floating point.
  1546. ;; Note that among the fix-to-float insns
  1547. ;; the ones that start with SImode come first.
  1548. ;; That is so that an operand that is a CONST_INT
  1549. ;; (and therefore lacks a specific machine mode).
  1550. ;; will be recognized as SImode (which is always valid)
  1551. ;; rather than as QImode or HImode.
  1552.  
  1553. (define_expand "floatsisf2"
  1554.   [(set (match_operand:SF 0 "general_operand" "")
  1555.     (float:SF (match_operand:SI 1 "general_operand" "")))]
  1556.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  1557.   "")
  1558.  
  1559. ;BHP - This may not need to be commented out
  1560. ;(define_insn ""
  1561. ;  [(set (match_operand:SF 0 "general_operand" "=y,x")
  1562. ;    (float:SF (match_operand:SI 1 "general_operand" "rmi,x")))]
  1563. ;  "TARGET_FPA"
  1564. ;  "fpltos %1,%0")
  1565.  
  1566. (define_insn ""
  1567.   [(set (match_operand:SF 0 "general_operand" "=f")
  1568.     (float:SF (match_operand:SI 1 "general_operand" "dmi")))]
  1569.   "TARGET_68881"
  1570.   "f%$move%.l %1,%0")
  1571.  
  1572. (define_insn ""
  1573.   [(set (match_operand:SF 0 "general_operand" "=rm")
  1574.     (float:SF (match_operand:SI 1 "general_operand" "rm")))]
  1575.   "TARGET_SANE"
  1576.   "* return output_sane_convert (operands);")
  1577.  
  1578. (define_expand "floatsidf2"
  1579.   [(set (match_operand:DF 0 "general_operand" "")
  1580.     (float:DF (match_operand:SI 1 "general_operand" "")))]
  1581.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  1582.   "")
  1583.  
  1584. (define_insn ""
  1585.   [(set (match_operand:DF 0 "general_operand" "=y,x")
  1586.     (float:DF (match_operand:SI 1 "general_operand" "rmi,x")))]
  1587.   "TARGET_FPA"
  1588.   "fpltod %1,%0")
  1589.  
  1590. (define_insn ""
  1591.   [(set (match_operand:DF 0 "general_operand" "=f")
  1592.     (float:DF (match_operand:SI 1 "general_operand" "dmi")))]
  1593.   "TARGET_68881"
  1594.   "f%&move%.l %1,%0")
  1595.  
  1596. (define_insn ""
  1597.   [(set (match_operand:DF 0 "general_operand" "=rm")
  1598.     (float:DF (match_operand:SI 1 "general_operand" "rm")))]
  1599.   "TARGET_SANE"
  1600.   "* return output_sane_convert (operands);")
  1601.  
  1602. (define_insn "floathisf2"
  1603.   [(set (match_operand:SF 0 "general_operand" "=f")
  1604.     (float:SF (match_operand:HI 1 "general_operand" "dmn")))]
  1605.   "TARGET_68881"
  1606.   "f%$move%.w %1,%0")
  1607.  
  1608. (define_insn "floathidf2"
  1609.   [(set (match_operand:DF 0 "general_operand" "=f")
  1610.     (float:DF (match_operand:HI 1 "general_operand" "dmn")))]
  1611.   "TARGET_68881"
  1612.   "fmove%.w %1,%0")
  1613.  
  1614. (define_insn "floatqisf2"
  1615.   [(set (match_operand:SF 0 "general_operand" "=f")
  1616.     (float:SF (match_operand:QI 1 "general_operand" "dmn")))]
  1617.   "TARGET_68881"
  1618.   "fmove%.b %1,%0")
  1619.  
  1620. (define_insn "floatqidf2"
  1621.   [(set (match_operand:DF 0 "general_operand" "=f")
  1622.     (float:DF (match_operand:QI 1 "general_operand" "dmn")))]
  1623.   "TARGET_68881"
  1624.   "f%&move%.b %1,%0")
  1625.  
  1626. ;; New routines to convert floating-point values to integers
  1627. ;; to be used on the '040.  These should be faster than trapping
  1628. ;; into the kernel to emulate fintrz.  They should also be faster
  1629. ;; than calling the subroutines fixsfsi() or fixdfsi().
  1630.  
  1631. (define_insn "fix_truncdfsi2"
  1632.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1633.     (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
  1634.    (clobber (match_scratch:SI 2 "=d"))
  1635.    (clobber (match_scratch:SI 3 "=d"))]
  1636.   "TARGET_68040"
  1637.   "*
  1638. {
  1639.   CC_STATUS_INIT;
  1640.   return \"fmovem%.l %!,%2\;moveq #16,%3\;or%.l %2,%3\;and%.w #-33,%3\;fmovem%.l %3,%!\;fmove%.l %1,%0\;fmovem%.l %2,%!\";
  1641. }")
  1642.  
  1643. (define_insn "fix_truncdfhi2"
  1644.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1645.     (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
  1646.    (clobber (match_scratch:SI 2 "=d"))
  1647.    (clobber (match_scratch:SI 3 "=d"))]
  1648.   "TARGET_68040"
  1649.   "*
  1650. {
  1651.   CC_STATUS_INIT;
  1652.   return \"fmovem%.l %!,%2\;moveq #16,%3\;or%.l %2,%3\;and%.w #-33,%3\;fmovem%.l %3,%!\;fmove%.w %1,%0\;fmovem%.l %2,%!\";
  1653. }")
  1654.  
  1655. (define_insn "fix_truncdfqi2"
  1656.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1657.     (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
  1658.    (clobber (match_scratch:SI 2 "=d"))
  1659.    (clobber (match_scratch:SI 3 "=d"))]
  1660.   "TARGET_68040"
  1661.   "*
  1662. {
  1663.   CC_STATUS_INIT;
  1664.   return \"fmovem%.l %!,%2\;moveq #16,%3\;or%.l %2,%3\;and%.w #-33,%3\;fmovem%.l %3,%!\;fmove%.b %1,%0\;fmovem%.l %2,%!\";
  1665. }")
  1666.  
  1667. ;; Convert a float to a float whose value is an integer.
  1668. ;; This is the first stage of converting it to an integer type.
  1669. (define_insn "ftruncdf2"
  1670.   [(set (match_operand:DF 0 "general_operand" "=f,ro")
  1671.     (fix:DF (match_operand:DF 1 "general_operand" "fFm,0")))]
  1672.   "(TARGET_68881 || TARGET_SANE) && !TARGET_68040"
  1673.   "*
  1674. {
  1675.   if(TARGET_68881) {
  1676.     if (FP_REG_P (operands[1]))
  1677.       return \"fintrz%.x %f1,%0\";
  1678.     return \"fintrz%.d %f1,%0\";
  1679.   } else {
  1680.       return output_sane_2 (operands, 0x0016, \"FTINTX\");
  1681.   }
  1682. }")
  1683.  
  1684. (define_insn "ftruncsf2"
  1685.   [(set (match_operand:SF 0 "general_operand" "=f")
  1686.     (fix:SF (match_operand:SF 1 "general_operand" "dfFm")))]
  1687.   "TARGET_68881 && !TARGET_68040"
  1688.   "*
  1689. {
  1690.   if (FP_REG_P (operands[1]))
  1691.     return \"fintrz%.x %f1,%0\";
  1692.   return \"fintrz%.s %f1,%0\";
  1693. }")
  1694.  
  1695. ;; Convert a float whose value is an integer
  1696. ;; to an actual integer.  Second stage of converting float to integer type.
  1697. (define_insn "fixsfqi2"
  1698.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1699.     (fix:QI (match_operand:SF 1 "general_operand" "f")))]
  1700.   "TARGET_68881"
  1701.   "fmove%.b %1,%0")
  1702.  
  1703. (define_insn "fixsfhi2"
  1704.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1705.     (fix:HI (match_operand:SF 1 "general_operand" "f")))]
  1706.   "TARGET_68881"
  1707.   "fmove%.w %1,%0")
  1708.  
  1709. (define_insn "fixsfsi2"
  1710.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1711.     (fix:SI (match_operand:SF 1 "general_operand" "f")))]
  1712.   "TARGET_68881"
  1713.   "fmove%.l %1,%0")
  1714.  
  1715. (define_insn "fixdfqi2"
  1716.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1717.     (fix:QI (match_operand:DF 1 "general_operand" "f")))]
  1718.   "TARGET_68881"
  1719.   "fmove%.b %1,%0")
  1720.  
  1721. (define_insn "fixdfhi2"
  1722.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1723.     (fix:HI (match_operand:DF 1 "general_operand" "f")))]
  1724.   "TARGET_68881"
  1725.   "fmove%.w %1,%0")
  1726.  
  1727. (define_insn "fixdfsi2"
  1728.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1729.     (fix:SI (match_operand:DF 1 "general_operand" "f")))]
  1730.   "TARGET_68881"
  1731.   "fmove%.l %1,%0")
  1732.  
  1733. ;; Convert a float to an integer.
  1734. ;; On the Sun FPA, this is done in one step.
  1735.  
  1736. (define_insn ""
  1737.   [(set (match_operand:SI 0 "general_operand" "=x,y")
  1738.     (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "xH,rmF"))))]
  1739.   "TARGET_FPA"
  1740.   "fpstol %w1,%0")
  1741.  
  1742. (define_insn ""
  1743.   [(set (match_operand:SI 0 "general_operand" "=x,y")
  1744.     (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "xH,rmF"))))]
  1745.   "TARGET_FPA"
  1746.   "fpdtol %y1,%0")
  1747.  
  1748. ;; add instructions
  1749.  
  1750. ;; Note that the middle two alternatives are near-duplicates
  1751. ;; in order to handle insns generated by reload.
  1752. ;; This is needed since they are not themselves reloaded,
  1753. ;; so commutativity won't apply to them.
  1754. ;;BHP - The s constraints are in the original 2.3.3 but not here.
  1755. (define_insn "addsi3"
  1756.   [(set (match_operand:SI 0 "general_operand" "=m,?a,?a,r")
  1757.     (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
  1758.          (match_operand:SI 2 "general_operand" "dIKL,rJK,a,mrIKL")))]
  1759.   ""
  1760.   "*
  1761. {
  1762.   if (! operands_match_p (operands[0], operands[1]))
  1763.     {
  1764.       if (!ADDRESS_REG_P (operands[1]))
  1765.     {
  1766.       rtx tmp = operands[1];
  1767.  
  1768.       operands[1] = operands[2];
  1769.       operands[2] = tmp;
  1770.     }
  1771.  
  1772.       /* These insns can result from reloads to access
  1773.      stack slots over 64k from the frame pointer.  */
  1774.       if (GET_CODE (operands[2]) == CONST_INT
  1775.       && INTVAL (operands[2]) + 0x8000 >= (unsigned) 0x10000)
  1776.         return \"move%.l %2,%0\;add%.l %1,%0\";
  1777. #ifdef SGS
  1778.       if (GET_CODE (operands[2]) == REG)
  1779.     return \"lea 0(%1,%2.l),%0\";
  1780.       else
  1781.     return \"lea %c2(%1),%0\";
  1782. #else /* not SGS */
  1783. #ifdef MOTOROLA
  1784.       if (GET_CODE (operands[2]) == REG)
  1785.     return \"lea (%1,%2.l),%0\";
  1786.       else
  1787.     return \"lea (%c2,%1),%0\";
  1788. #else /* not MOTOROLA (MIT syntax) */
  1789.       if (GET_CODE (operands[2]) == REG)
  1790.     return \"lea %1@(0,%2:l),%0\";
  1791.       else
  1792.     return \"lea %1@(%c2),%0\";
  1793. #endif /* not MOTOROLA */
  1794. #endif /* not SGS */
  1795.     }
  1796.   if (GET_CODE (operands[2]) == CONST_INT)
  1797.     {
  1798. #ifndef NO_ADDSUB_Q
  1799.       if (INTVAL (operands[2]) > 0
  1800.       && INTVAL (operands[2]) <= 8)
  1801.     return (ADDRESS_REG_P (operands[0])
  1802.         ? \"addq%.w %2,%0\"
  1803.         : \"addq%.l %2,%0\");
  1804.       if (INTVAL (operands[2]) < 0
  1805.       && INTVAL (operands[2]) >= -8)
  1806.         {
  1807.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1808.                      - INTVAL (operands[2]));
  1809.       return (ADDRESS_REG_P (operands[0])
  1810.           ? \"subq%.w %2,%0\"
  1811.           : \"subq%.l %2,%0\");
  1812.     }
  1813.       /* On everything except the 68000 it is faster to use two
  1814.      addqw instructions to add a small integer (8 < N <= 16)
  1815.      to an address register.  Likewise for subqw.*/
  1816.       if (INTVAL (operands[2]) > 8
  1817.       && INTVAL (operands[2]) <= 16
  1818.       && ADDRESS_REG_P (operands[0])
  1819.       && TARGET_68020) 
  1820.     {
  1821.       operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 8);
  1822.       return \"addq%.w %#8,%0\;addq%.w %2,%0\";
  1823.     }
  1824.       if (INTVAL (operands[2]) < -8
  1825.       && INTVAL (operands[2]) >= -16
  1826.       && ADDRESS_REG_P (operands[0])
  1827.       && TARGET_68020) 
  1828.     {
  1829.       operands[2] = gen_rtx (CONST_INT, VOIDmode, 
  1830.                   - INTVAL (operands[2]) - 8);
  1831.       return \"subq%.w %#8,%0\;subq%.w %2,%0\";
  1832.     }
  1833. #endif
  1834.       if (ADDRESS_REG_P (operands[0])
  1835.       && INTVAL (operands[2]) >= -0x8000
  1836.       && INTVAL (operands[2]) < 0x8000)
  1837.     return \"add%.w %2,%0\";
  1838.     }
  1839.   return \"add%.l %2,%0\";
  1840. }")
  1841.  
  1842. (define_insn ""
  1843.   [(set (match_operand:SI 0 "general_operand" "=a")
  1844.     (plus:SI (match_operand:SI 1 "general_operand" "0")
  1845.          (sign_extend:SI
  1846.           (match_operand:HI 2 "nonimmediate_operand" "rm"))))]
  1847.   ""
  1848.   "add%.w %2,%0")
  1849.  
  1850. (define_insn "addhi3"
  1851.   [(set (match_operand:HI 0 "general_operand" "=m,r")
  1852.     (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
  1853.          (match_operand:HI 2 "general_operand" "dn,rmn")))]
  1854.   ""
  1855.   "*
  1856. {
  1857. #ifndef NO_ADDSUB_Q
  1858.   if (GET_CODE (operands[2]) == CONST_INT)
  1859.     {
  1860.       /* If the constant would be a negative number when interpreted as
  1861.      HImode, make it negative.  This is usually, but not always, done
  1862.      elsewhere in the compiler.  First check for constants out of range,
  1863.      which could confuse us.  */
  1864.  
  1865.       if (INTVAL (operands[2]) >= 32768)
  1866.     operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1867.                    INTVAL (operands[2]) - 65536);
  1868.  
  1869.       if (INTVAL (operands[2]) > 0
  1870.       && INTVAL (operands[2]) <= 8)
  1871.     return \"addq%.w %2,%0\";
  1872.       if (INTVAL (operands[2]) < 0
  1873.       && INTVAL (operands[2]) >= -8)
  1874.     {
  1875.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1876.                      - INTVAL (operands[2]));
  1877.       return \"subq%.w %2,%0\";
  1878.     }
  1879.       /* On everything except the 68000 it is faster to use two
  1880.      addqw instructions to add a small integer (8 < N <= 16)
  1881.      to an address register.  Likewise for subqw. */
  1882.       if (INTVAL (operands[2]) > 8
  1883.       && INTVAL (operands[2]) <= 16
  1884.       && ADDRESS_REG_P (operands[0])
  1885.       && TARGET_68020) 
  1886.     {
  1887.       operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 8);
  1888.       return \"addq%.w %#8,%0\;addq%.w %2,%0\";
  1889.     }
  1890.       if (INTVAL (operands[2]) < -8
  1891.       && INTVAL (operands[2]) >= -16
  1892.       && ADDRESS_REG_P (operands[0])
  1893.       && TARGET_68020) 
  1894.     {
  1895.       operands[2] = gen_rtx (CONST_INT, VOIDmode, 
  1896.                  - INTVAL (operands[2]) - 8);
  1897.       return \"subq%.w %#8,%0\;subq%.w %2,%0\";
  1898.     }
  1899.     }
  1900. #endif
  1901.   return \"add%.w %2,%0\";
  1902. }")
  1903.  
  1904. ;; These insns must use MATCH_DUP instead of the more expected
  1905. ;; use of a matching constraint because the "output" here is also
  1906. ;; an input, so you can't use the matching constraint.  That also means
  1907. ;; that you can't use the "%", so you need patterns with the matched
  1908. ;; operand in both positions.
  1909.  
  1910. (define_insn ""
  1911.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  1912.     (plus:HI (match_dup 0)
  1913.          (match_operand:HI 1 "general_operand" "dn,rmn")))]
  1914.   ""
  1915.   "*
  1916. {
  1917. #ifndef NO_ADDSUB_Q
  1918.   if (GET_CODE (operands[1]) == CONST_INT)
  1919.     {
  1920.       /* If the constant would be a negative number when interpreted as
  1921.      HImode, make it negative.  This is usually, but not always, done
  1922.      elsewhere in the compiler.  First check for constants out of range,
  1923.      which could confuse us.  */
  1924.  
  1925.       if (INTVAL (operands[1]) >= 32768)
  1926.     operands[1] = gen_rtx (CONST_INT, VOIDmode,
  1927.                    INTVAL (operands[1]) - 65536);
  1928.  
  1929.       if (INTVAL (operands[1]) > 0
  1930.       && INTVAL (operands[1]) <= 8)
  1931.     return \"addq%.w %1,%0\";
  1932.       if (INTVAL (operands[1]) < 0
  1933.       && INTVAL (operands[1]) >= -8)
  1934.     {
  1935.       operands[1] = gen_rtx (CONST_INT, VOIDmode,
  1936.                      - INTVAL (operands[1]));
  1937.       return \"subq%.w %1,%0\";
  1938.     }
  1939.       /* On everything except the 68000 it is faster to use two
  1940.      addqw instructions to add a small integer (8 < N <= 16)
  1941.      to an address register.  Likewise for subqw. */
  1942.       if (INTVAL (operands[1]) > 8
  1943.       && INTVAL (operands[1]) <= 16
  1944.       && ADDRESS_REG_P (operands[0])
  1945.       && TARGET_68020) 
  1946.     {
  1947.       operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) - 8);
  1948.       return \"addq%.w %#8,%0\;addq%.w %1,%0\";
  1949.     }
  1950.       if (INTVAL (operands[1]) < -8
  1951.       && INTVAL (operands[1]) >= -16
  1952.       && ADDRESS_REG_P (operands[0])
  1953.       && TARGET_68020) 
  1954.     {
  1955.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  1956.                  - INTVAL (operands[1]) - 8);
  1957.       return \"subq%.w %#8,%0\;subq%.w %1,%0\";
  1958.     }
  1959.     }
  1960. #endif
  1961.   return \"add%.w %1,%0\";
  1962. }")
  1963.  
  1964. (define_insn ""
  1965.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  1966.     (plus:HI (match_operand:HI 1 "general_operand" "dn,rmn")
  1967.          (match_dup 0)))]
  1968.   ""
  1969.   "*
  1970. {
  1971. #ifndef NO_ADDSUB_Q
  1972.   if (GET_CODE (operands[1]) == CONST_INT)
  1973.     {
  1974.       /* If the constant would be a negative number when interpreted as
  1975.      HImode, make it negative.  This is usually, but not always, done
  1976.      elsewhere in the compiler.  First check for constants out of range,
  1977.      which could confuse us.  */
  1978.  
  1979.       if (INTVAL (operands[1]) >= 32768)
  1980.     operands[1] = gen_rtx (CONST_INT, VOIDmode,
  1981.                    INTVAL (operands[1]) - 65536);
  1982.  
  1983.       if (INTVAL (operands[1]) > 0
  1984.       && INTVAL (operands[1]) <= 8)
  1985.     return \"addq%.w %1,%0\";
  1986.       if (INTVAL (operands[1]) < 0
  1987.       && INTVAL (operands[1]) >= -8)
  1988.     {
  1989.       operands[1] = gen_rtx (CONST_INT, VOIDmode,
  1990.                      - INTVAL (operands[1]));
  1991.       return \"subq%.w %1,%0\";
  1992.     }
  1993.       /* On everything except the 68000 it is faster to use two
  1994.      addqw instructions to add a small integer (8 < N <= 16)
  1995.      to an address register.  Likewise for subqw. */
  1996.       if (INTVAL (operands[1]) > 8
  1997.       && INTVAL (operands[1]) <= 16
  1998.       && ADDRESS_REG_P (operands[0])
  1999.       && TARGET_68020) 
  2000.     {
  2001.       operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) - 8);
  2002.       return \"addq%.w %#8,%0\;addq%.w %1,%0\";
  2003.     }
  2004.       if (INTVAL (operands[1]) < -8
  2005.       && INTVAL (operands[1]) >= -16
  2006.       && ADDRESS_REG_P (operands[0])
  2007.       && TARGET_68020) 
  2008.     {
  2009.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  2010.                  - INTVAL (operands[1]) - 8);
  2011.       return \"subq%.w %#8,%0\;subq%.w %1,%0\";
  2012.     }
  2013.     }
  2014. #endif
  2015.   return \"add%.w %1,%0\";
  2016. }")
  2017.  
  2018. (define_insn "addqi3"
  2019.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  2020.     (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
  2021.          (match_operand:QI 2 "general_operand" "dn,dmn")))]
  2022.   ""
  2023.   "*
  2024. {
  2025. #ifndef NO_ADDSUB_Q
  2026.   if (GET_CODE (operands[2]) == CONST_INT)
  2027.     {
  2028.       if (INTVAL (operands[2]) >= 128)
  2029.     operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2030.                    INTVAL (operands[2]) - 256);
  2031.  
  2032.       if (INTVAL (operands[2]) > 0
  2033.       && INTVAL (operands[2]) <= 8)
  2034.     return \"addq%.b %2,%0\";
  2035.       if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
  2036.        {
  2037.      operands[2] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[2]));
  2038.      return \"subq%.b %2,%0\";
  2039.        }
  2040.     }
  2041. #endif
  2042.   return \"add%.b %2,%0\";
  2043. }")
  2044.  
  2045. (define_insn ""
  2046.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  2047.     (plus:QI (match_dup 0)
  2048.          (match_operand:QI 1 "general_operand" "dn,dmn")))]
  2049.   ""
  2050.   "*
  2051. {
  2052. #ifndef NO_ADDSUB_Q
  2053.   if (GET_CODE (operands[1]) == CONST_INT)
  2054.     {
  2055.       if (INTVAL (operands[1]) >= 128)
  2056.     operands[1] = gen_rtx (CONST_INT, VOIDmode,
  2057.                    INTVAL (operands[1]) - 256);
  2058.  
  2059.       if (INTVAL (operands[1]) > 0
  2060.       && INTVAL (operands[1]) <= 8)
  2061.     return \"addq%.b %1,%0\";
  2062.       if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
  2063.        {
  2064.      operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
  2065.      return \"subq%.b %1,%0\";
  2066.        }
  2067.     }
  2068. #endif
  2069.   return \"add%.b %1,%0\";
  2070. }")
  2071.  
  2072. (define_insn ""
  2073.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  2074.     (plus:QI (match_operand:QI 1 "general_operand" "dn,dmn")
  2075.          (match_dup 0)))]
  2076.   ""
  2077.   "*
  2078. {
  2079. #ifndef NO_ADDSUB_Q
  2080.   if (GET_CODE (operands[1]) == CONST_INT)
  2081.     {
  2082.       if (INTVAL (operands[1]) >= 128)
  2083.     operands[1] = gen_rtx (CONST_INT, VOIDmode,
  2084.                    INTVAL (operands[1]) - 256);
  2085.  
  2086.       if (INTVAL (operands[1]) > 0
  2087.       && INTVAL (operands[1]) <= 8)
  2088.     return \"addq%.b %1,%0\";
  2089.       if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
  2090.        {
  2091.      operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
  2092.      return \"subq%.b %1,%0\";
  2093.        }
  2094.     }
  2095. #endif
  2096.   return \"add%.b %1,%0\";
  2097. }")
  2098.  
  2099. (define_expand "adddf3"
  2100.   [(set (match_operand:DF 0 "general_operand" "")
  2101.     (plus:DF (match_operand:DF 1 "general_operand" "")
  2102.          (match_operand:DF 2 "general_operand" "")))]
  2103.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  2104.   "")
  2105.  
  2106. (define_insn ""
  2107.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  2108.     (plus:DF (match_operand:DF 1 "general_operand" "%xH,y")
  2109.          (match_operand:DF 2 "general_operand" "xH,dmF")))]
  2110.   "TARGET_FPA"
  2111.   "*
  2112. {
  2113.   if (rtx_equal_p (operands[0], operands[1]))
  2114.     return \"fpadd%.d %y2,%0\";
  2115.   if (rtx_equal_p (operands[0], operands[2]))
  2116.     return \"fpadd%.d %y1,%0\";
  2117.   if (which_alternative == 0)
  2118.     return \"fpadd3%.d %w2,%w1,%0\";
  2119.   return \"fpadd3%.d %x2,%x1,%0\";
  2120. }")
  2121.  
  2122. (define_insn ""
  2123.   [(set (match_operand:DF 0 "general_operand" "=f")
  2124.     (plus:DF (match_operand:DF 1 "general_operand" "%0")
  2125.          (match_operand:DF 2 "general_operand" "fmG")))]
  2126.   "TARGET_68881"
  2127.   "*
  2128. {
  2129.   if (REG_P (operands[2]))
  2130.     return \"f%&add%.x %2,%0\";
  2131.   return \"f%&add%.d %f2,%0\";
  2132. }")
  2133.  
  2134. (define_expand "addsf3"
  2135.   [(set (match_operand:SF 0 "general_operand" "")
  2136.     (plus:SF (match_operand:SF 1 "general_operand" "")
  2137.          (match_operand:SF 2 "general_operand" "")))]
  2138.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  2139.   "")
  2140.  
  2141. (define_insn ""
  2142.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  2143.     (plus:SF (match_operand:SF 1 "general_operand" "%xH,y")
  2144.          (match_operand:SF 2 "general_operand" "xH,rmF")))]
  2145.   "TARGET_FPA"
  2146.   "*
  2147. {
  2148.   if (rtx_equal_p (operands[0], operands[1]))
  2149.     return \"fpadd%.s %w2,%0\";
  2150.   if (rtx_equal_p (operands[0], operands[2]))
  2151.     return \"fpadd%.s %w1,%0\";
  2152.   if (which_alternative == 0)
  2153.     return \"fpadd3%.s %w2,%w1,%0\";
  2154.   return \"fpadd3%.s %2,%1,%0\";
  2155. }")
  2156.  
  2157. (define_insn ""
  2158.   [(set (match_operand:SF 0 "general_operand" "=f")
  2159.     (plus:SF (match_operand:SF 1 "general_operand" "%0")
  2160.          (match_operand:SF 2 "general_operand" "fdmF")))]
  2161.   "TARGET_68881"
  2162.   "*
  2163. {
  2164.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2165.     return \"f%$add%.x %2,%0\";
  2166.   return \"f%$add%.s %f2,%0\";
  2167. }")
  2168.  
  2169. ;; subtract instructions
  2170.  
  2171. (define_insn "subsi3"
  2172.   [(set (match_operand:SI 0 "general_operand" "=m,r,!a,?d")
  2173.     (minus:SI (match_operand:SI 1 "general_operand" "0,0,a,mrIKs")
  2174.           (match_operand:SI 2 "general_operand" "dIKs,mrIKs,J,0")))]
  2175.   ""
  2176.   "*
  2177. {
  2178.   if (! operands_match_p (operands[0], operands[1]))
  2179.     {
  2180.       if (operands_match_p (operands[0], operands[2]))
  2181.     {
  2182. #ifndef NO_ADDSUB_Q
  2183.       if (GET_CODE (operands[1]) == CONST_INT)
  2184.         {
  2185.           if (INTVAL (operands[1]) > 0
  2186.           && INTVAL (operands[1]) <= 8)
  2187.         return \"subq%.l %1,%0\;neg%.l %0\";
  2188.         }
  2189. #endif
  2190.       return \"sub%.l %1,%0\;neg%.l %0\";
  2191.     }
  2192.       /* This case is matched by J, but negating -0x8000
  2193.          in an lea would give an invalid displacement.
  2194.      So do this specially.  */
  2195.       if (INTVAL (operands[2]) == -0x8000)
  2196.     return \"move%.l %1,%0\;sub%.l %2,%0\";
  2197. #ifdef SGS
  2198.       return \"lea %n2(%1),%0\";
  2199. #else
  2200. #ifdef MOTOROLA
  2201.       return \"lea (%n2,%1),%0\";
  2202. #else /* not MOTOROLA (MIT syntax) */
  2203.       return \"lea %1@(%n2),%0\";
  2204. #endif /* not MOTOROLA */
  2205. #endif /* not SGS */
  2206.     }
  2207.   if (GET_CODE (operands[2]) == CONST_INT)
  2208.     {
  2209. #ifndef NO_ADDSUB_Q
  2210.       if (INTVAL (operands[2]) > 0
  2211.       && INTVAL (operands[2]) <= 8)
  2212.     return \"subq%.l %2,%0\";
  2213.       /* Using two subqw for 8 < N <= 16 being subtracted from an
  2214.      address register is faster on all but 68000 */
  2215.       if (INTVAL (operands[2]) > 8
  2216.       && INTVAL (operands[2]) <= 16
  2217.       && ADDRESS_REG_P (operands[0])
  2218.       && TARGET_68020)
  2219.     {
  2220.       operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 8);
  2221.       return \"subq%.w %#8,%0\;subq%.w %2,%0\";
  2222.     }
  2223. #endif
  2224.       if (ADDRESS_REG_P (operands[0])
  2225.       && INTVAL (operands[2]) >= -0x8000
  2226.       && INTVAL (operands[2]) < 0x8000)
  2227.     return \"sub%.w %2,%0\";
  2228.     }
  2229.   return \"sub%.l %2,%0\";
  2230. }")
  2231.  
  2232. (define_insn ""
  2233.   [(set (match_operand:SI 0 "general_operand" "=a")
  2234.     (minus:SI (match_operand:SI 1 "general_operand" "0")
  2235.           (sign_extend:SI
  2236.            (match_operand:HI 2 "nonimmediate_operand" "rm"))))]
  2237.   ""
  2238.   "sub%.w %2,%0")
  2239.  
  2240. (define_insn "subhi3"
  2241.   [(set (match_operand:HI 0 "general_operand" "=m,r")
  2242.     (minus:HI (match_operand:HI 1 "general_operand" "0,0")
  2243.           (match_operand:HI 2 "general_operand" "dn,rmn")))]
  2244.   ""
  2245.   "sub%.w %2,%0")
  2246.  
  2247. (define_insn ""
  2248.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  2249.     (minus:HI (match_dup 0)
  2250.           (match_operand:HI 1 "general_operand" "dn,rmn")))]
  2251.   ""
  2252.   "sub%.w %1,%0")
  2253.  
  2254. (define_insn "subqi3"
  2255.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  2256.     (minus:QI (match_operand:QI 1 "general_operand" "0,0")
  2257.           (match_operand:QI 2 "general_operand" "dn,dmn")))]
  2258.   ""
  2259.   "sub%.b %2,%0")
  2260.  
  2261. (define_insn ""
  2262.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  2263.     (minus:QI (match_dup 0)
  2264.           (match_operand:QI 1 "general_operand" "dn,dmn")))]
  2265.   ""
  2266.   "sub%.b %1,%0")
  2267.  
  2268. (define_expand "subdf3"
  2269.   [(set (match_operand:DF 0 "general_operand" "")
  2270.     (minus:DF (match_operand:DF 1 "general_operand" "")
  2271.           (match_operand:DF 2 "general_operand" "")))]
  2272.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  2273.   "")
  2274.  
  2275. (define_insn ""
  2276.   [(set (match_operand:DF 0 "general_operand" "=x,y,y")
  2277.     (minus:DF (match_operand:DF 1 "general_operand" "xH,y,dmF")
  2278.           (match_operand:DF 2 "general_operand" "xH,dmF,0")))]
  2279.   "TARGET_FPA"
  2280.   "*
  2281. {
  2282.   if (rtx_equal_p (operands[0], operands[2]))
  2283.     return \"fprsub%.d %y1,%0\";
  2284.   if (rtx_equal_p (operands[0], operands[1]))
  2285.     return \"fpsub%.d %y2,%0\";
  2286.   if (which_alternative == 0)
  2287.     return \"fpsub3%.d %w2,%w1,%0\";
  2288.   return \"fpsub3%.d %x2,%x1,%0\";
  2289. }")
  2290.  
  2291. (define_insn ""
  2292.   [(set (match_operand:DF 0 "general_operand" "=f")
  2293.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  2294.           (match_operand:DF 2 "general_operand" "fmG")))]
  2295.   "TARGET_68881"
  2296.   "*
  2297. {
  2298.   if (REG_P (operands[2]))
  2299.     return \"f%&sub%.x %2,%0\";
  2300.   return \"f%&sub%.d %f2,%0\";
  2301. }")
  2302.  
  2303. (define_expand "subsf3"
  2304.   [(set (match_operand:SF 0 "general_operand" "")
  2305.     (minus:SF (match_operand:SF 1 "general_operand" "")
  2306.           (match_operand:SF 2 "general_operand" "")))]
  2307.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  2308.   "")
  2309.  
  2310. (define_insn ""
  2311.   [(set (match_operand:SF 0 "general_operand" "=x,y,y")
  2312.     (minus:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
  2313.           (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
  2314.   "TARGET_FPA"
  2315.   "*
  2316. {
  2317.   if (rtx_equal_p (operands[0], operands[2]))
  2318.     return \"fprsub%.s %w1,%0\";
  2319.   if (rtx_equal_p (operands[0], operands[1]))
  2320.     return \"fpsub%.s %w2,%0\";
  2321.   if (which_alternative == 0)
  2322.     return \"fpsub3%.s %w2,%w1,%0\";
  2323.   return \"fpsub3%.s %2,%1,%0\";
  2324. }")
  2325.  
  2326. (define_insn ""
  2327.   [(set (match_operand:SF 0 "general_operand" "=f")
  2328.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  2329.           (match_operand:SF 2 "general_operand" "fdmF")))]
  2330.   "TARGET_68881"
  2331.   "*
  2332. {
  2333.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2334.     return \"f%$sub%.x %2,%0\";
  2335.   return \"f%$sub%.s %f2,%0\";
  2336. }")
  2337.  
  2338. ;; multiply instructions
  2339.  
  2340. (define_insn "mulhi3"
  2341.   [(set (match_operand:HI 0 "general_operand" "=d")
  2342.     (mult:HI (match_operand:HI 1 "general_operand" "%0")
  2343.          (match_operand:HI 2 "general_operand" "dmn")))]
  2344.   ""
  2345.   "*
  2346. {
  2347. #if defined(MOTOROLA) && !defined(CRDS)
  2348.   return \"muls%.w %2,%0\";
  2349. #else
  2350.   return \"muls %2,%0\";
  2351. #endif
  2352. }")
  2353.  
  2354. (define_insn "mulhisi3"
  2355.   [(set (match_operand:SI 0 "general_operand" "=d")
  2356.     (mult:SI (sign_extend:SI
  2357.           (match_operand:HI 1 "nonimmediate_operand" "%0"))
  2358.          (sign_extend:SI
  2359.           (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
  2360.   ""
  2361.   "*
  2362. {
  2363. #if defined(MOTOROLA) && !defined(CRDS)
  2364.   return \"muls%.w %2,%0\";
  2365. #else
  2366.   return \"muls %2,%0\";
  2367. #endif
  2368. }")
  2369.  
  2370. ;;BHP - removed TARGET_68020 condition
  2371. (define_insn ""
  2372.   [(set (match_operand:SI 0 "general_operand" "=d")
  2373.     (mult:SI (sign_extend:SI
  2374.           (match_operand:HI 1 "nonimmediate_operand" "%0"))
  2375.          (match_operand:SI 2 "const_int_operand" "n")))]
  2376.   ""
  2377.   "*
  2378. {
  2379. #if defined(MOTOROLA) && !defined(CRDS)
  2380.   return \"muls%.w %2,%0\";
  2381. #else
  2382.   return \"muls %2,%0\";
  2383. #endif
  2384. }")
  2385.  
  2386. (define_insn "mulsi3"
  2387.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  2388.     (mult:SI (match_operand:SI 1 "general_operand" "%0,0")
  2389.          (match_operand:SI 2 "general_operand" "dmsK,dsK")))]
  2390.   "TARGET_INTLIB || TARGET_68020"
  2391.   "*
  2392.       if(TARGET_68020) {
  2393.         return \"muls.l %2,%0\";
  2394.     } else {
  2395.         return output_int_lib_call (operands, \"ULMULT\");
  2396.     }
  2397.   ")
  2398.  
  2399. (define_insn "umulhisi3"
  2400.   [(set (match_operand:SI 0 "general_operand" "=d")
  2401.     (mult:SI (zero_extend:SI
  2402.           (match_operand:HI 1 "nonimmediate_operand" "%0"))
  2403.          (zero_extend:SI
  2404.           (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
  2405.   ""
  2406.   "*
  2407. {
  2408. #if defined(MOTOROLA) && !defined(CRDS)
  2409.   return \"mulu%.w %2,%0\";
  2410. #else
  2411.   return \"mulu %2,%0\";
  2412. #endif
  2413. }")
  2414.  
  2415. (define_insn ""
  2416.   [(set (match_operand:SI 0 "general_operand" "=d")
  2417.     (mult:SI (zero_extend:SI
  2418.           (match_operand:HI 1 "nonimmediate_operand" "%0"))
  2419.          (match_operand:SI 2 "const_int_operand" "n")))]
  2420.   ""
  2421.   "*
  2422. {
  2423. #if defined(MOTOROLA) && !defined(CRDS)
  2424.   return \"mulu%.w %2,%0\";
  2425. #else
  2426.   return \"mulu %2,%0\";
  2427. #endif
  2428. }")
  2429.  
  2430. ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
  2431. ;; proper matching constraint.  This is because the matching is between
  2432. ;; the high-numbered word of the DImode operand[0] and operand[1].
  2433. (define_expand "umulsidi3"
  2434.   [(parallel
  2435.     [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 1)
  2436.       (subreg:SI
  2437.        (mult:DI (zero_extend:DI
  2438.              (match_operand:SI 1 "register_operand" ""))
  2439.             (zero_extend:DI
  2440.              (match_operand:SI 2 "nonimmediate_operand" ""))) 1))
  2441.      (set (subreg:SI (match_dup 0) 0)
  2442.       (subreg:SI
  2443.        (mult:DI (zero_extend:DI
  2444.              (match_dup 1))
  2445.             (zero_extend:DI
  2446.              (match_dup 2))) 0))])]
  2447.   "TARGET_68020"
  2448.   "")
  2449.  
  2450. (define_insn ""
  2451.   [(set (match_operand:SI 0 "register_operand" "=d")
  2452.     (subreg:SI
  2453.      (mult:DI (zero_extend:DI
  2454.            (match_operand:SI 1 "register_operand" "%0"))
  2455.           (zero_extend:DI
  2456.            (match_operand:SI 2 "nonimmediate_operand" "dm"))) 1))
  2457.    (set (match_operand:SI 3 "register_operand" "=d")
  2458.     (subreg:SI
  2459.      (mult:DI (zero_extend:DI
  2460.            (match_dup 1))
  2461.           (zero_extend:DI
  2462.            (match_dup 2))) 0))]
  2463.   "TARGET_68020"
  2464.   "mulu%.l %2,%3:%0")
  2465.  
  2466. (define_insn ""
  2467.   [(set (match_operand:SI 0 "register_operand" "=d")
  2468.     (subreg:SI
  2469.      (mult:DI (zero_extend:DI
  2470.            (match_operand:SI 1 "register_operand" "%0"))
  2471.           (match_operand:SI 2 "immediate_operand" "sK")) 1))
  2472.    (set (match_operand:SI 3 "register_operand" "=d")
  2473.     (subreg:SI
  2474.      (mult:DI (zero_extend:DI
  2475.            (match_dup 1))
  2476.           (match_dup 2)) 0))]
  2477.   "TARGET_68020
  2478.    && (GET_CODE (operands[2]) != CONST_INT
  2479.        || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
  2480.   "mulu%.l %2,%3:%0")
  2481.  
  2482. (define_expand "mulsidi3"
  2483.   [(parallel
  2484.     [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 1)
  2485.       (subreg:SI
  2486.        (mult:DI (sign_extend:DI
  2487.              (match_operand:SI 1 "register_operand" ""))
  2488.             (sign_extend:DI
  2489.              (match_operand:SI 2 "nonimmediate_operand" ""))) 1))
  2490.      (set (subreg:SI (match_dup 0) 0)
  2491.       (subreg:SI
  2492.        (mult:DI (sign_extend:DI
  2493.              (match_dup 1))
  2494.             (sign_extend:DI
  2495.              (match_dup 2))) 0))])]
  2496.   "TARGET_68020"
  2497.   "")
  2498.  
  2499. (define_insn ""
  2500.   [(set (match_operand:SI 0 "register_operand" "=d")
  2501.     (subreg:SI
  2502.      (mult:DI (sign_extend:DI
  2503.            (match_operand:SI 1 "register_operand" "%0"))
  2504.           (sign_extend:DI
  2505.            (match_operand:SI 2 "nonimmediate_operand" "dm"))) 1))
  2506.    (set (match_operand:SI 3 "register_operand" "=d")
  2507.     (subreg:SI
  2508.      (mult:DI (sign_extend:DI
  2509.            (match_dup 1))
  2510.           (sign_extend:DI
  2511.            (match_dup 2))) 0))]
  2512.   "TARGET_68020"
  2513.   "muls%.l %2,%3:%0")
  2514.  
  2515. (define_insn ""
  2516.   [(set (match_operand:SI 0 "register_operand" "=d")
  2517.     (subreg:SI
  2518.      (mult:DI (sign_extend:DI
  2519.            (match_operand:SI 1 "register_operand" "%0"))
  2520.           (match_operand:SI 2 "immediate_operand" "sK")) 1))
  2521.    (set (match_operand:SI 3 "register_operand" "=d")
  2522.     (subreg:SI
  2523.      (mult:DI (sign_extend:DI
  2524.            (match_dup 1))
  2525.            (match_dup 2)) 0))]
  2526.   "TARGET_68020
  2527.    && (GET_CODE (operands[2]) != CONST_INT
  2528.        || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))"
  2529.   "muls%.l %2,%3:%0")
  2530.  
  2531. (define_expand "muldf3"
  2532.   [(set (match_operand:DF 0 "general_operand" "")
  2533.     (mult:DF (match_operand:DF 1 "general_operand" "")
  2534.          (match_operand:DF 2 "general_operand" "")))]
  2535.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  2536.   "")
  2537.  
  2538. (define_insn ""
  2539.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  2540.     (mult:DF (match_operand:DF 1 "general_operand" "%xH,y")
  2541.          (match_operand:DF 2 "general_operand" "xH,rmF")))]
  2542.   "TARGET_FPA"
  2543.   "*
  2544. {
  2545.   if (rtx_equal_p (operands[1], operands[2]))
  2546.     return \"fpsqr%.d %y1,%0\";
  2547.   if (rtx_equal_p (operands[0], operands[1]))
  2548.     return \"fpmul%.d %y2,%0\";
  2549.   if (rtx_equal_p (operands[0], operands[2]))
  2550.     return \"fpmul%.d %y1,%0\";
  2551.   if (which_alternative == 0)
  2552.     return \"fpmul3%.d %w2,%w1,%0\";
  2553.   return \"fpmul3%.d %x2,%x1,%0\";
  2554. }")
  2555.  
  2556. (define_insn ""
  2557.   [(set (match_operand:DF 0 "general_operand" "=f")
  2558.     (mult:DF (match_operand:DF 1 "general_operand" "%0")
  2559.          (match_operand:DF 2 "general_operand" "fmG")))]
  2560.   "TARGET_68881"
  2561.   "*
  2562. {
  2563.   if (GET_CODE (operands[2]) == CONST_DOUBLE
  2564.       && floating_exact_log2 (operands[2]) && !TARGET_68040)
  2565.     {
  2566.       int i = floating_exact_log2 (operands[2]);
  2567.       operands[2] = gen_rtx (CONST_INT, VOIDmode, i);
  2568.       return \"fscale%.l %2,%0\";
  2569.     }
  2570.   if (REG_P (operands[2]))
  2571.     return \"f%&mul%.x %2,%0\";
  2572.   return \"f%&mul%.d %f2,%0\";
  2573. }")
  2574.  
  2575. (define_expand "mulsf3"
  2576.   [(set (match_operand:SF 0 "general_operand" "")
  2577.     (mult:SF (match_operand:SF 1 "general_operand" "")
  2578.          (match_operand:SF 2 "general_operand" "")))]
  2579.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  2580.   "")
  2581.  
  2582. (define_insn ""
  2583.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  2584.     (mult:SF (match_operand:SF 1 "general_operand" "%xH,y")
  2585.          (match_operand:SF 2 "general_operand" "xH,rmF")))]
  2586.   "TARGET_FPA"
  2587.   "*
  2588. {
  2589.   if (rtx_equal_p (operands[1], operands[2]))
  2590.     return \"fpsqr%.s %w1,%0\";
  2591.   if (rtx_equal_p (operands[0], operands[1]))
  2592.     return \"fpmul%.s %w2,%0\";
  2593.   if (rtx_equal_p (operands[0], operands[2]))
  2594.     return \"fpmul%.s %w1,%0\";
  2595.   if (which_alternative == 0)
  2596.     return \"fpmul3%.s %w2,%w1,%0\";
  2597.   return \"fpmul3%.s %2,%1,%0\";
  2598. }")
  2599.  
  2600. (define_insn ""
  2601.   [(set (match_operand:SF 0 "general_operand" "=f")
  2602.     (mult:SF (match_operand:SF 1 "general_operand" "%0")
  2603.          (match_operand:SF 2 "general_operand" "fdmF")))]
  2604.   "TARGET_68881"
  2605.   "*
  2606. {
  2607. #ifdef FSGLMUL_USE_S
  2608.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2609.     return (TARGET_68040_ONLY
  2610.         ? \"fsmul%.s %2,%0\"
  2611.         : \"fsglmul%.s %2,%0\");
  2612. #else
  2613.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2614.     return (TARGET_68040_ONLY
  2615.         ? \"fsmul%.x %2,%0\"
  2616.         : \"fsglmul%.x %2,%0\");
  2617. #endif
  2618.   return (TARGET_68040_ONLY
  2619.       ? \"fsmul%.s %f2,%0\"
  2620.       : \"fsglmul%.s %f2,%0\");
  2621. }")
  2622.  
  2623. (define_insn ""
  2624.   [(set (match_operand:SF 0 "general_operand" "=ro")
  2625.     (mult:SF (match_operand:SF 1 "general_operand" "%0")
  2626.          (match_operand:SF 2 "general_operand" "ro")))]
  2627.   "TARGET_SANE"
  2628.   "* return output_sane_3 (operands, 0x1004, \"FMULS\");")
  2629.  
  2630.  
  2631. ;; divide instructions
  2632.  
  2633. (define_insn "divhi3"
  2634.   [(set (match_operand:HI 0 "general_operand" "=d")
  2635.     (div:HI (match_operand:HI 1 "general_operand" "0")
  2636.         (match_operand:HI 2 "general_operand" "dmn")))]
  2637.   ""
  2638.   "*
  2639. {
  2640. #ifdef MOTOROLA
  2641.   return \"ext%.l %0\;divs%.w %2,%0\";
  2642. #else
  2643.   return \"extl %0\;divs %2,%0\";
  2644. #endif
  2645. }")
  2646.  
  2647. (define_insn "divhisi3"
  2648.   [(set (match_operand:HI 0 "general_operand" "=d")
  2649.     (truncate:HI
  2650.      (div:SI
  2651.       (match_operand:SI 1 "general_operand" "0")
  2652.       (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
  2653.   ""
  2654.   "*
  2655. {
  2656. #ifdef MOTOROLA
  2657.   return \"divs%.w %2,%0\";
  2658. #else
  2659.   return \"divs %2,%0\";
  2660. #endif
  2661. }")
  2662.  
  2663. (define_insn ""
  2664.   [(set (match_operand:HI 0 "general_operand" "=d")
  2665.     (truncate:HI (div:SI (match_operand:SI 1 "general_operand" "0")
  2666.                  (match_operand:SI 2 "const_int_operand" "n"))))]
  2667.   ""
  2668.   "*
  2669. {
  2670. #ifdef MOTOROLA
  2671.   return \"divs%.w %2,%0\";
  2672. #else
  2673.   return \"divs %2,%0\";
  2674. #endif
  2675. }")
  2676.  
  2677. (define_insn "udivhi3"
  2678.   [(set (match_operand:HI 0 "general_operand" "=d")
  2679.     (udiv:HI (match_operand:HI 1 "general_operand" "0")
  2680.          (match_operand:HI 2 "general_operand" "dmn")))]
  2681.   ""
  2682.   "*
  2683. {
  2684. #ifdef MOTOROLA
  2685. #ifdef MPW_ASM
  2686.   return \"and%.l %#$FFFF,%0\;divu%.w %2,%0\";
  2687. #else
  2688.   return \"and%.l %#0xFFFF,%0\;divu%.w %2,%0\";
  2689. #endif
  2690. #else
  2691.   return \"andl %#0xFFFF,%0\;divu %2,%0\";
  2692. #endif
  2693. }")
  2694.  
  2695. (define_insn "udivhisi3"
  2696.   [(set (match_operand:HI 0 "general_operand" "=d")
  2697.     (truncate:HI
  2698.      (udiv:SI
  2699.       (match_operand:SI 1 "general_operand" "0")
  2700.       (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
  2701.   ""
  2702.   "*
  2703. {
  2704. #ifdef MOTOROLA
  2705.   return \"divu%.w %2,%0\";
  2706. #else
  2707.   return \"divu %2,%0\";
  2708. #endif
  2709. }")
  2710.  
  2711. (define_insn ""
  2712.   [(set (match_operand:HI 0 "general_operand" "=d")
  2713.     (truncate:HI (udiv:SI (match_operand:SI 1 "general_operand" "0")
  2714.                   (match_operand:SI 2 "const_int_operand" "n"))))]
  2715.   ""
  2716.   "*
  2717. {
  2718. #ifdef MOTOROLA
  2719.   return \"divu%.w %2,%0\";
  2720. #else
  2721.   return \"divu %2,%0\";
  2722. #endif
  2723. }")
  2724.  
  2725. (define_expand "divdf3"
  2726.   [(set (match_operand:DF 0 "general_operand" "")
  2727.     (div:DF (match_operand:DF 1 "general_operand" "")
  2728.         (match_operand:DF 2 "general_operand" "")))]
  2729.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  2730.   "")
  2731.  
  2732. (define_insn ""
  2733.   [(set (match_operand:DF 0 "general_operand" "=x,y,y")
  2734.     (div:DF (match_operand:DF 1 "general_operand" "xH,y,rmF")
  2735.         (match_operand:DF 2 "general_operand" "xH,rmF,0")))]
  2736.   "TARGET_FPA"
  2737.   "*
  2738. {
  2739.   if (rtx_equal_p (operands[0], operands[2]))
  2740.     return \"fprdiv%.d %y1,%0\";
  2741.   if (rtx_equal_p (operands[0], operands[1]))
  2742.     return \"fpdiv%.d %y2,%0\";
  2743.   if (which_alternative == 0)
  2744.     return \"fpdiv3%.d %w2,%w1,%0\";
  2745.   return \"fpdiv3%.d %x2,%x1,%x0\";
  2746. }")
  2747.  
  2748. (define_insn ""
  2749.   [(set (match_operand:DF 0 "general_operand" "=f")
  2750.     (div:DF (match_operand:DF 1 "general_operand" "0")
  2751.         (match_operand:DF 2 "general_operand" "fmG")))]
  2752.   "TARGET_68881"
  2753.   "*
  2754. {
  2755.   if (REG_P (operands[2]))
  2756.     return \"f%&div%.x %2,%0\";
  2757.   return \"f%&div%.d %f2,%0\";
  2758. }")
  2759.  
  2760. (define_expand "divsf3"
  2761.   [(set (match_operand:SF 0 "general_operand" "")
  2762.     (div:SF (match_operand:SF 1 "general_operand" "")
  2763.         (match_operand:SF 2 "general_operand" "")))]
  2764.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  2765.   "")
  2766.  
  2767. (define_insn ""
  2768.   [(set (match_operand:SF 0 "general_operand" "=x,y,y")
  2769.     (div:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
  2770.         (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
  2771.   "TARGET_FPA"
  2772.   "*
  2773. {
  2774.   if (rtx_equal_p (operands[0], operands[1]))
  2775.     return \"fpdiv%.s %w2,%0\";
  2776.   if (rtx_equal_p (operands[0], operands[2]))
  2777.     return \"fprdiv%.s %w1,%0\";
  2778.   if (which_alternative == 0)
  2779.     return \"fpdiv3%.s %w2,%w1,%0\";
  2780.   return \"fpdiv3%.s %2,%1,%0\";
  2781. }")
  2782.  
  2783. (define_insn ""
  2784.   [(set (match_operand:SF 0 "general_operand" "=f")
  2785.     (div:SF (match_operand:SF 1 "general_operand" "0")
  2786.         (match_operand:SF 2 "general_operand" "fdmF")))]
  2787.   "TARGET_68881"
  2788.   "*
  2789. {
  2790. #ifdef FSGLDIV_USE_S
  2791.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2792.     return (TARGET_68040_ONLY
  2793.         ? \"fsdiv%.s %2,%0\"
  2794.         : \"fsgldiv%.s %2,%0\");
  2795. #else
  2796.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2797.     return (TARGET_68040_ONLY
  2798.         ? \"fsdiv%.x %2,%0\"
  2799.         : \"fsgldiv%.x %2,%0\");
  2800. #endif
  2801.   return (TARGET_68040_ONLY
  2802.       ? \"fsdiv%.s %f2,%0\"
  2803.       : \"fsgldiv%.s %f2,%0\");
  2804. }")
  2805.  
  2806. ;; Remainder instructions.
  2807.  
  2808. (define_insn "modhi3"
  2809.   [(set (match_operand:HI 0 "general_operand" "=d")
  2810.     (mod:HI (match_operand:HI 1 "general_operand" "0")
  2811.         (match_operand:HI 2 "general_operand" "dmn")))]
  2812.   ""
  2813.   "*
  2814. {
  2815.   /* The swap insn produces cc's that don't correspond to the result.  */
  2816.   CC_STATUS_INIT;
  2817. #ifdef MOTOROLA
  2818.   return \"ext%.l %0\;divs%.w %2,%0\;swap %0\";
  2819. #else
  2820.   return \"extl %0\;divs %2,%0\;swap %0\";
  2821. #endif
  2822. }")
  2823.  
  2824. (define_insn "modhisi3"
  2825.   [(set (match_operand:HI 0 "general_operand" "=d")
  2826.     (truncate:HI
  2827.      (mod:SI
  2828.       (match_operand:SI 1 "general_operand" "0")
  2829.       (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
  2830.   ""
  2831.   "*
  2832. {
  2833.   /* The swap insn produces cc's that don't correspond to the result.  */
  2834.   CC_STATUS_INIT;
  2835. #ifdef MOTOROLA
  2836.   return \"divs%.w %2,%0\;swap %0\";
  2837. #else
  2838.   return \"divs %2,%0\;swap %0\";
  2839. #endif
  2840. }")
  2841.  
  2842. (define_insn ""
  2843.   [(set (match_operand:HI 0 "general_operand" "=d")
  2844.     (truncate:HI (mod:SI (match_operand:SI 1 "general_operand" "0")
  2845.                  (match_operand:SI 2 "const_int_operand" "n"))))]
  2846.   ""
  2847.   "*
  2848. {
  2849.   /* The swap insn produces cc's that don't correspond to the result.  */
  2850.   CC_STATUS_INIT;
  2851. #ifdef MOTOROLA
  2852.   return \"divs%.w %2,%0\;swap %0\";
  2853. #else
  2854.   return \"divs %2,%0\;swap %0\";
  2855. #endif
  2856. }")
  2857.  
  2858. (define_insn "umodhi3"
  2859.   [(set (match_operand:HI 0 "general_operand" "=d")
  2860.     (umod:HI (match_operand:HI 1 "general_operand" "0")
  2861.          (match_operand:HI 2 "general_operand" "dmn")))]
  2862.   ""
  2863.   "*
  2864. {
  2865.   /* The swap insn produces cc's that don't correspond to the result.  */
  2866.   CC_STATUS_INIT;
  2867. #ifdef MOTOROLA
  2868. #ifdef MPW_ASM
  2869.   return \"and%.l %#$FFFF,%0\;divu%.w %2,%0\;swap %0\";
  2870. #else
  2871.   return \"and%.l %#0xFFFF,%0\;divu%.w %2,%0\;swap %0\";
  2872. #endif
  2873. #else
  2874.   return \"andl %#0xFFFF,%0\;divu %2,%0\;swap %0\";
  2875. #endif
  2876. }")
  2877.  
  2878. (define_insn "umodhisi3"
  2879.   [(set (match_operand:HI 0 "general_operand" "=d")
  2880.     (truncate:HI
  2881.      (umod:SI
  2882.       (match_operand:SI 1 "general_operand" "0")
  2883.       (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
  2884.   ""
  2885.   "*
  2886. {
  2887.   /* The swap insn produces cc's that don't correspond to the result.  */
  2888.   CC_STATUS_INIT;
  2889. #ifdef MOTOROLA
  2890.   return \"divu%.w %2,%0\;swap %0\";
  2891. #else
  2892.   return \"divu %2,%0\;swap %0\";
  2893. #endif
  2894. }")
  2895.  
  2896. (define_insn ""
  2897.   [(set (match_operand:HI 0 "general_operand" "=d")
  2898.     (truncate:HI (umod:SI (match_operand:SI 1 "general_operand" "0")
  2899.                   (match_operand:SI 2 "const_int_operand" "n"))))]
  2900.   ""
  2901.   "*
  2902. {
  2903.   /* The swap insn produces cc's that don't correspond to the result.  */
  2904.   CC_STATUS_INIT;
  2905. #ifdef MOTOROLA
  2906.   return \"divu%.w %2,%0\;swap %0\";
  2907. #else
  2908.   return \"divu %2,%0\;swap %0\";
  2909. #endif
  2910. }")
  2911.  
  2912. (define_insn "divmodsi4"
  2913.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  2914.     (div:SI (match_operand:SI 1 "general_operand" "0,0")
  2915.         (match_operand:SI 2 "general_operand" "dmsK,dsK")))
  2916.    (set (match_operand:SI 3 "general_operand" "=d,d")
  2917.     (mod:SI (match_dup 1) (match_dup 2)))]
  2918.   "TARGET_68020 || TARGET_INTLIB"
  2919.   "*
  2920. {
  2921.   if(TARGET_68020) {
  2922.     if (find_reg_note (insn, REG_UNUSED, operands[3]))
  2923.       return \"divs%.l %2,%0\";
  2924.     else
  2925.       return \"tdivs%.l %2,%3:%0\";
  2926.   } else {
  2927.     return output_int_lib_call (operands, \"LDIVT\");
  2928.   }
  2929. }")
  2930.  
  2931. (define_insn "udivmodsi4"
  2932.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  2933.     (udiv:SI (match_operand:SI 1 "general_operand" "0,0")
  2934.          (match_operand:SI 2 "general_operand" "dmsK,dsK")))
  2935.    (set (match_operand:SI 3 "general_operand" "=d,d")
  2936.     (umod:SI (match_dup 1) (match_dup 2)))]
  2937.   "TARGET_68020 || TARGET_INTLIB"
  2938.   "*
  2939. {
  2940.   if(TARGET_68020) {
  2941.     if (find_reg_note (insn, REG_UNUSED, operands[3]))
  2942.       return \"divu%.l %2,%0\";
  2943.     else
  2944.       return \"tdivu%.l %2,%3:%0\";
  2945.   } else {
  2946.     return output_int_lib_call (operands, \"ULDIVT\");
  2947.   }
  2948. }")
  2949.  
  2950. ;; logical-and instructions
  2951.  
  2952. ;; Prevent AND from being made with sp.  This doesn't exist in the machine
  2953. ;; and reload will cause inefficient code.  Since sp is a FIXED_REG, we
  2954. ;; can't allocate pseudos into it.
  2955. (define_insn "andsi3"
  2956.   [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
  2957.     (and:SI (match_operand:SI 1 "general_operand" "%0,0")
  2958.         (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
  2959.   ""
  2960.   "*
  2961. {
  2962.   int logval;
  2963.   if (GET_CODE (operands[2]) == CONST_INT
  2964.       && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
  2965.       && (DATA_REG_P (operands[0])
  2966.       || offsettable_memref_p (operands[0])))
  2967.     { 
  2968.       if (GET_CODE (operands[0]) != REG)
  2969.         operands[0] = adj_offsettable_operand (operands[0], 2);
  2970.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2971.                  INTVAL (operands[2]) & 0xffff);
  2972.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  2973.       CC_STATUS_INIT;
  2974.       if (operands[2] == const0_rtx)
  2975.         return \"clr%.w %0\";
  2976.       return \"and%.w %2,%0\";
  2977.     }
  2978.   if (GET_CODE (operands[2]) == CONST_INT
  2979.       && (logval = exact_log2 (~ INTVAL (operands[2]))) >= 0
  2980.       && (DATA_REG_P (operands[0])
  2981.           || offsettable_memref_p (operands[0])))
  2982.     { 
  2983.       if (DATA_REG_P (operands[0]))
  2984.         {
  2985.           operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
  2986.         }
  2987.       else
  2988.         {
  2989.           operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));          operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
  2990.         }
  2991.       /* This does not set condition codes in a standard way.  */
  2992.       CC_STATUS_INIT;
  2993.       return \"bclr %1,%0\";
  2994.     }
  2995.   return \"and%.l %2,%0\";
  2996. }")
  2997.  
  2998. (define_insn "andhi3"
  2999.   [(set (match_operand:HI 0 "general_operand" "=m,d")
  3000.     (and:HI (match_operand:HI 1 "general_operand" "%0,0")
  3001.         (match_operand:HI 2 "general_operand" "dn,dmn")))]
  3002.   ""
  3003.   "and%.w %2,%0")
  3004.  
  3005. (define_insn ""
  3006.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  3007.     (and:HI (match_dup 0)
  3008.         (match_operand:HI 1 "general_operand" "dn,dmn")))]
  3009.   ""
  3010.   "and%.w %1,%0")
  3011.  
  3012. (define_insn ""
  3013.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  3014.     (and:HI (match_operand:HI 1 "general_operand" "dn,dmn")
  3015.         (match_dup 0)))]
  3016.   ""
  3017.   "and%.w %1,%0")
  3018.  
  3019. (define_insn "andqi3"
  3020.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  3021.     (and:QI (match_operand:QI 1 "general_operand" "%0,0")
  3022.         (match_operand:QI 2 "general_operand" "dn,dmn")))]
  3023.   ""
  3024.   "and%.b %2,%0")
  3025.  
  3026. (define_insn ""
  3027.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  3028.     (and:QI (match_dup 0)
  3029.         (match_operand:QI 1 "general_operand" "dn,dmn")))]
  3030.   ""
  3031.   "and%.b %1,%0")
  3032.  
  3033. (define_insn ""
  3034.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  3035.     (and:QI (match_operand:QI 1 "general_operand" "dn,dmn")
  3036.         (match_dup 0)))]
  3037.   ""
  3038.   "and%.b %1,%0")
  3039.  
  3040. ;; inclusive-or instructions
  3041.  
  3042. (define_insn "iorsi3"
  3043.   [(set (match_operand:SI 0 "general_operand" "=m,d")
  3044.     (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
  3045.         (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
  3046.   ""
  3047.   "*
  3048. {
  3049.   register int logval;
  3050.   if (GET_CODE (operands[2]) == CONST_INT
  3051.       && INTVAL (operands[2]) >> 16 == 0
  3052.       && (DATA_REG_P (operands[0])
  3053.       || offsettable_memref_p (operands[0])))
  3054.     { 
  3055.       if (GET_CODE (operands[0]) != REG)
  3056.         operands[0] = adj_offsettable_operand (operands[0], 2);
  3057.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  3058.       CC_STATUS_INIT;
  3059.       return \"or%.w %2,%0\";
  3060.     }
  3061.   if (GET_CODE (operands[2]) == CONST_INT
  3062.       && (logval = exact_log2 (INTVAL (operands[2]))) >= 0
  3063.       && (DATA_REG_P (operands[0])
  3064.       || offsettable_memref_p (operands[0])))
  3065.     { 
  3066.       if (DATA_REG_P (operands[0]))
  3067.     {
  3068.       operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
  3069.     }
  3070.       else
  3071.         {
  3072.       operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
  3073.       operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
  3074.     }
  3075.       return \"bset %1,%0\";
  3076.     }
  3077.   return \"or%.l %2,%0\";
  3078. }")
  3079.  
  3080. (define_insn "iorhi3"
  3081.   [(set (match_operand:HI 0 "general_operand" "=m,d")
  3082.     (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
  3083.         (match_operand:HI 2 "general_operand" "dn,dmn")))]
  3084.   ""
  3085.   "or%.w %2,%0")
  3086.  
  3087. (define_insn ""
  3088.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  3089.     (ior:HI (match_dup 0)
  3090.         (match_operand:HI 1 "general_operand" "dn,dmn")))]
  3091.   ""
  3092.   "or%.w %1,%0")
  3093.  
  3094. (define_insn ""
  3095.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  3096.     (ior:HI (match_operand:HI 1 "general_operand" "dn,dmn")
  3097.         (match_dup 0)))]
  3098.   ""
  3099.   "or%.w %1,%0")
  3100.  
  3101. (define_insn "iorqi3"
  3102.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  3103.     (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
  3104.         (match_operand:QI 2 "general_operand" "dn,dmn")))]
  3105.   ""
  3106.   "or%.b %2,%0")
  3107.  
  3108. (define_insn ""
  3109.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  3110.     (ior:QI (match_dup 0)
  3111.         (match_operand:QI 1 "general_operand" "dn,dmn")))]
  3112.   ""
  3113.   "or%.b %1,%0")
  3114.  
  3115. (define_insn ""
  3116.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  3117.     (ior:QI (match_operand:QI 1 "general_operand" "dn,dmn")
  3118.         (match_dup 0)))]
  3119.   ""
  3120.   "or%.b %1,%0")
  3121.  
  3122. ;; xor instructions
  3123.  
  3124. (define_insn "xorsi3"
  3125.   [(set (match_operand:SI 0 "general_operand" "=do,m")
  3126.     (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
  3127.         (match_operand:SI 2 "general_operand" "di,dKs")))]
  3128.   ""
  3129.   "*
  3130. {
  3131.   if (GET_CODE (operands[2]) == CONST_INT
  3132.       && INTVAL (operands[2]) >> 16 == 0
  3133.       && (offsettable_memref_p (operands[0]) || DATA_REG_P (operands[0])))
  3134.     { 
  3135.       if (! DATA_REG_P (operands[0]))
  3136.     operands[0] = adj_offsettable_operand (operands[0], 2);
  3137.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  3138.       CC_STATUS_INIT;
  3139.       return \"eor%.w %2,%0\";
  3140.     }
  3141.   return \"eor%.l %2,%0\";
  3142. }")
  3143.  
  3144. (define_insn "xorhi3"
  3145.   [(set (match_operand:HI 0 "general_operand" "=dm")
  3146.     (xor:HI (match_operand:HI 1 "general_operand" "%0")
  3147.         (match_operand:HI 2 "general_operand" "dn")))]
  3148.   ""
  3149.   "eor%.w %2,%0")
  3150.  
  3151. (define_insn ""
  3152.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  3153.     (xor:HI (match_dup 0)
  3154.         (match_operand:HI 1 "general_operand" "dn")))]
  3155.   ""
  3156.   "eor%.w %1,%0")
  3157.  
  3158.  
  3159. (define_insn ""
  3160.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  3161.     (xor:HI (match_operand:HI 1 "general_operand" "dn")
  3162.         (match_dup 0)))]
  3163.   ""
  3164.   "eor%.w %1,%0")
  3165.  
  3166. (define_insn "xorqi3"
  3167.   [(set (match_operand:QI 0 "general_operand" "=dm")
  3168.     (xor:QI (match_operand:QI 1 "general_operand" "%0")
  3169.         (match_operand:QI 2 "general_operand" "dn")))]
  3170.   ""
  3171.   "eor%.b %2,%0")
  3172.  
  3173. (define_insn ""
  3174.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  3175.     (xor:QI (match_dup 0)
  3176.         (match_operand:QI 1 "general_operand" "dn")))]
  3177.   ""
  3178.   "eor%.b %1,%0")
  3179.  
  3180. (define_insn ""
  3181.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  3182.     (xor:QI (match_operand:QI 1 "general_operand" "dn")
  3183.         (match_dup 0)))]
  3184.   ""
  3185.   "eor%.b %1,%0")
  3186.  
  3187. ;; negation instructions
  3188.  
  3189. (define_insn "negsi2"
  3190.   [(set (match_operand:SI 0 "general_operand" "=dm")
  3191.     (neg:SI (match_operand:SI 1 "general_operand" "0")))]
  3192.   ""
  3193.   "neg%.l %0")
  3194.  
  3195. (define_insn "neghi2"
  3196.   [(set (match_operand:HI 0 "general_operand" "=dm")
  3197.     (neg:HI (match_operand:HI 1 "general_operand" "0")))]
  3198.   ""
  3199.   "neg%.w %0")
  3200.  
  3201. (define_insn ""
  3202.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  3203.     (neg:HI (match_dup 0)))]
  3204.   ""
  3205.   "neg%.w %0")
  3206.  
  3207. (define_insn "negqi2"
  3208.   [(set (match_operand:QI 0 "general_operand" "=dm")
  3209.     (neg:QI (match_operand:QI 1 "general_operand" "0")))]
  3210.   ""
  3211.   "neg%.b %0")
  3212.  
  3213. (define_insn ""
  3214.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  3215.     (neg:QI (match_dup 0)))]
  3216.   ""
  3217.   "neg%.b %0")
  3218.  
  3219. (define_expand "negsf2"
  3220.   [(set (match_operand:SF 0 "general_operand" "")
  3221.     (neg:SF (match_operand:SF 1 "general_operand" "")))]
  3222.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  3223.   "")
  3224.  
  3225. (define_insn ""
  3226.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  3227.     (neg:SF (match_operand:SF 1 "general_operand" "xH,rmF")))]
  3228.   "TARGET_FPA"
  3229.   "fpneg%.s %w1,%0")
  3230.  
  3231. (define_insn ""
  3232.   [(set (match_operand:SF 0 "general_operand" "=f,d")
  3233.     (neg:SF (match_operand:SF 1 "general_operand" "fdmF,0")))]
  3234.   "TARGET_68881"
  3235.   "*
  3236. {
  3237.   if (DATA_REG_P (operands[0]))
  3238.     {
  3239.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 31);
  3240.       return \"bchg %1,%0\";
  3241.     }
  3242.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  3243.     return \"f%$neg%.x %1,%0\";
  3244.   return \"f%$neg%.s %f1,%0\";
  3245. }")
  3246.  
  3247. (define_expand "negdf2"
  3248.   [(set (match_operand:DF 0 "general_operand" "")
  3249.     (neg:DF (match_operand:DF 1 "general_operand" "")))]
  3250.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  3251.   "")
  3252.  
  3253. (define_insn ""
  3254.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  3255.     (neg:DF (match_operand:DF 1 "general_operand" "xH,rmF")))]
  3256.   "TARGET_FPA"
  3257.   "fpneg%.d %y1, %0")
  3258.  
  3259. (define_insn ""
  3260.   [(set (match_operand:DF 0 "general_operand" "=f,d")
  3261.     (neg:DF (match_operand:DF 1 "general_operand" "fmF,0")))]
  3262.   "TARGET_68881"
  3263.   "*
  3264. {
  3265.   if (DATA_REG_P (operands[0]))
  3266.     {
  3267.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 31);
  3268.       return \"bchg %1,%0\";
  3269.     }
  3270.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  3271.     return \"f%&neg%.x %1,%0\";
  3272.   return \"f%&neg%.d %f1,%0\";
  3273. }")
  3274.  
  3275. ;; Sqrt instruction for the 68881
  3276.  
  3277. (define_insn "sqrtdf2"
  3278.   [(set (match_operand:DF 0 "general_operand" "=f")
  3279.     (sqrt:DF (match_operand:DF 1 "general_operand" "fm")))]
  3280.   "TARGET_68881"
  3281.   "*
  3282. {
  3283.   if (FP_REG_P (operands[1]))
  3284.     return \"fsqrt%.x %1,%0\";
  3285.   else
  3286.     return \"fsqrt%.d %1,%0\";
  3287. }")
  3288.  
  3289. ;; Absolute value instructions
  3290.  
  3291. (define_expand "abssf2"
  3292.   [(set (match_operand:SF 0 "general_operand" "")
  3293.     (abs:SF (match_operand:SF 1 "general_operand" "")))]
  3294.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  3295.   "")
  3296.  
  3297. (define_insn ""
  3298.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  3299.     (abs:SF (match_operand:SF 1 "general_operand" "xH,rmF")))]
  3300.   "TARGET_FPA"
  3301.   "fpabs%.s %y1,%0")
  3302.  
  3303. (define_insn ""
  3304.   [(set (match_operand:SF 0 "general_operand" "=f")
  3305.     (abs:SF (match_operand:SF 1 "general_operand" "fdmF")))]
  3306.   "TARGET_68881"
  3307.   "*
  3308. {
  3309.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  3310.     return \"f%$abs%.x %1,%0\";
  3311.   return \"f%$abs%.s %f1,%0\";
  3312. }")
  3313.  
  3314. (define_expand "absdf2"
  3315.   [(set (match_operand:DF 0 "general_operand" "")
  3316.     (abs:DF (match_operand:DF 1 "general_operand" "")))]
  3317.   "TARGET_68881 || TARGET_FPA || TARGET_SANE"
  3318.   "")
  3319.  
  3320. (define_insn ""
  3321.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  3322.     (abs:DF (match_operand:DF 1 "general_operand" "xH,rmF")))]
  3323.   "TARGET_FPA"
  3324.   "fpabs%.d %y1,%0")
  3325.  
  3326. (define_insn ""
  3327.   [(set (match_operand:DF 0 "general_operand" "=f")
  3328.     (abs:DF (match_operand:DF 1 "general_operand" "fmF")))]
  3329.   "TARGET_68881"
  3330.   "*
  3331. {
  3332.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  3333.     return \"f%&abs%.x %1,%0\";
  3334.   return \"f%&abs%.d %f1,%0\";
  3335. }")
  3336.  
  3337. ;; one complement instructions
  3338.  
  3339. (define_insn "one_cmplsi2"
  3340.   [(set (match_operand:SI 0 "general_operand" "=dm")
  3341.     (not:SI (match_operand:SI 1 "general_operand" "0")))]
  3342.   ""
  3343.   "not%.l %0")
  3344.  
  3345. (define_insn "one_cmplhi2"
  3346.   [(set (match_operand:HI 0 "general_operand" "=dm")
  3347.     (not:HI (match_operand:HI 1 "general_operand" "0")))]
  3348.   ""
  3349.   "not%.w %0")
  3350.  
  3351. (define_insn ""
  3352.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  3353.     (not:HI (match_dup 0)))]
  3354.   ""
  3355.   "not%.w %0")
  3356.  
  3357. (define_insn "one_cmplqi2"
  3358.   [(set (match_operand:QI 0 "general_operand" "=dm")
  3359.     (not:QI (match_operand:QI 1 "general_operand" "0")))]
  3360.   ""
  3361.   "not%.b %0")
  3362.  
  3363. (define_insn ""
  3364.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  3365.     (not:QI (match_dup 0)))]
  3366.   ""
  3367.   "not%.b %0")
  3368.  
  3369. ;; arithmetic shift instructions
  3370. ;; We don't need the shift memory by 1 bit instruction
  3371.  
  3372. ;; On all 68k models, this makes faster code in a special case.
  3373.  
  3374. (define_insn ""
  3375.   [(set (match_operand:SI 0 "register_operand" "=d")
  3376.     (ashift:SI (match_operand:SI 1 "register_operand" "0")
  3377.            (match_operand:SI 2 "immediate_operand" "i")))]
  3378.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)"
  3379.   "*
  3380. {
  3381.   CC_STATUS_INIT;
  3382.   return \"swap %0\;clr%.w %0\";
  3383. }")
  3384.  
  3385. ;; On the 68000, this makes faster code in a special case.
  3386.  
  3387. (define_insn ""
  3388.   [(set (match_operand:SI 0 "register_operand" "=d")
  3389.     (ashift:SI (match_operand:SI 1 "register_operand" "0")
  3390.            (match_operand:SI 2 "immediate_operand" "i")))]
  3391.   "(! TARGET_68020 && GET_CODE (operands[2]) == CONST_INT
  3392.     && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
  3393.   "*
  3394. {
  3395.   CC_STATUS_INIT;
  3396.  
  3397.   operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
  3398.   return \"asl%.w %2,%0\;swap %0\;clr%.w %0\";
  3399. }")
  3400.  
  3401. (define_insn "ashlsi3"
  3402.   [(set (match_operand:SI 0 "register_operand" "=d")
  3403.     (ashift:SI (match_operand:SI 1 "register_operand" "0")
  3404.            (match_operand:SI 2 "general_operand" "dI")))]
  3405.   ""
  3406.   "*
  3407. {
  3408.   if (operands[2] == const1_rtx)
  3409.     return \"add%.l %0,%0\";
  3410.   return \"asl%.l %2,%0\";
  3411. }")
  3412.  
  3413. (define_insn "ashlhi3"
  3414.   [(set (match_operand:HI 0 "register_operand" "=d")
  3415.     (ashift:HI (match_operand:HI 1 "register_operand" "0")
  3416.            (match_operand:HI 2 "general_operand" "dI")))]
  3417.   ""
  3418.   "asl%.w %2,%0")
  3419.  
  3420. (define_insn ""
  3421.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  3422.     (ashift:HI (match_dup 0)
  3423.            (match_operand:HI 1 "general_operand" "dI")))]
  3424.   ""
  3425.   "asl%.w %1,%0")
  3426.  
  3427. (define_insn "ashlqi3"
  3428.   [(set (match_operand:QI 0 "register_operand" "=d")
  3429.     (ashift:QI (match_operand:QI 1 "register_operand" "0")
  3430.            (match_operand:QI 2 "general_operand" "dI")))]
  3431.   ""
  3432.   "asl%.b %2,%0")
  3433.  
  3434. (define_insn ""
  3435.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  3436.     (ashift:QI (match_dup 0)
  3437.            (match_operand:QI 1 "general_operand" "dI")))]
  3438.   ""
  3439.   "asl%.b %1,%0")
  3440.  
  3441. ;; On all 68k models, this makes faster code in a special case.
  3442.  
  3443. (define_insn ""
  3444.   [(set (match_operand:SI 0 "register_operand" "=d")
  3445.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
  3446.              (match_operand:SI 2 "immediate_operand" "i")))]
  3447.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)" 
  3448.   "swap %0\;ext%.l %0")
  3449.  
  3450. ;; On the 68000, this makes faster code in a special case.
  3451.  
  3452. (define_insn ""
  3453.   [(set (match_operand:SI 0 "register_operand" "=d")
  3454.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
  3455.              (match_operand:SI 2 "immediate_operand" "i")))]
  3456.   "(! TARGET_68020 && GET_CODE (operands[2]) == CONST_INT
  3457.     && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
  3458.   "*
  3459. {
  3460.   operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
  3461.   return \"swap %0\;asr%.w %2,%0\;ext%.l %0\";
  3462. }")
  3463.  
  3464. (define_insn "ashrsi3"
  3465.   [(set (match_operand:SI 0 "register_operand" "=d")
  3466.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
  3467.              (match_operand:SI 2 "general_operand" "dI")))]
  3468.   ""
  3469.   "*
  3470. {
  3471.   return \"asr%.l %2,%0\";
  3472. }")
  3473.  
  3474. (define_insn "ashrhi3"
  3475.   [(set (match_operand:HI 0 "register_operand" "=d")
  3476.     (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
  3477.              (match_operand:HI 2 "general_operand" "dI")))]
  3478.   ""
  3479.   "asr%.w %2,%0")
  3480.  
  3481. (define_insn ""
  3482.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  3483.     (ashiftrt:HI (match_dup 0)
  3484.              (match_operand:HI 1 "general_operand" "dI")))]
  3485.   ""
  3486.   "asr%.w %1,%0")
  3487.  
  3488. (define_insn "ashrqi3"
  3489.   [(set (match_operand:QI 0 "register_operand" "=d")
  3490.     (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
  3491.              (match_operand:QI 2 "general_operand" "dI")))]
  3492.   ""
  3493.   "asr%.b %2,%0")
  3494.  
  3495. (define_insn ""
  3496.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  3497.     (ashiftrt:QI (match_dup 0)
  3498.              (match_operand:QI 1 "general_operand" "dI")))]
  3499.   ""
  3500.   "asr%.b %1,%0")
  3501.  
  3502. ;; logical shift instructions
  3503.  
  3504. ;; On all 68k models, this makes faster code in a special case.
  3505.  
  3506. (define_insn ""
  3507.   [(set (match_operand:SI 0 "register_operand" "=d")
  3508.     (lshift:SI (match_operand:SI 1 "register_operand" "0")
  3509.            (match_operand:SI 2 "immediate_operand" "i")))]
  3510.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)"
  3511.   "*
  3512. {
  3513.   CC_STATUS_INIT;
  3514.   return \"swap %0\;clr%.w %0\";
  3515. }")
  3516.  
  3517. ;; On the 68000, this makes faster code in a special case.
  3518.  
  3519. (define_insn ""
  3520.   [(set (match_operand:SI 0 "register_operand" "=d")
  3521.     (lshift:SI (match_operand:SI 1 "register_operand" "0")
  3522.            (match_operand:SI 2 "immediate_operand" "i")))]
  3523.   "(! TARGET_68020 && GET_CODE (operands[2]) == CONST_INT
  3524.     && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
  3525.   "*
  3526. {
  3527.   CC_STATUS_INIT;
  3528.  
  3529.   operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
  3530.   return \"lsl%.w %2,%0\;swap %0\;clr%.w %0\";
  3531. }")
  3532.  
  3533. (define_insn "lshlsi3"
  3534.   [(set (match_operand:SI 0 "register_operand" "=d")
  3535.     (lshift:SI (match_operand:SI 1 "register_operand" "0")
  3536.            (match_operand:SI 2 "general_operand" "dI")))]
  3537.   ""
  3538.   "*
  3539. {
  3540.   if (operands[2] == const1_rtx)
  3541.     return \"add%.l %0,%0\";
  3542.   return \"lsl%.l %2,%0\";
  3543. }")
  3544.  
  3545. (define_insn "lshlhi3"
  3546.   [(set (match_operand:HI 0 "register_operand" "=d")
  3547.     (lshift:HI (match_operand:HI 1 "register_operand" "0")
  3548.            (match_operand:HI 2 "general_operand" "dI")))]
  3549.   ""
  3550.   "lsl%.w %2,%0")
  3551.  
  3552. (define_insn ""
  3553.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  3554.     (lshift:HI (match_dup 0)
  3555.            (match_operand:HI 1 "general_operand" "dI")))]
  3556.   ""
  3557.   "lsl%.w %1,%0")
  3558.  
  3559. (define_insn "lshlqi3"
  3560.   [(set (match_operand:QI 0 "register_operand" "=d")
  3561.     (lshift:QI (match_operand:QI 1 "register_operand" "0")
  3562.            (match_operand:QI 2 "general_operand" "dI")))]
  3563.   ""
  3564.   "lsl%.b %2,%0")
  3565.  
  3566. (define_insn ""
  3567.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  3568.     (lshift:QI (match_dup 0)
  3569.            (match_operand:QI 1 "general_operand" "dI")))]
  3570.   ""
  3571.   "lsl%.b %1,%0")
  3572.  
  3573. ;; On all 68k models, this makes faster code in a special case.
  3574.  
  3575. (define_insn ""
  3576.   [(set (match_operand:SI 0 "register_operand" "=d")
  3577.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
  3578.              (match_operand:SI 2 "immediate_operand" "i")))]
  3579.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)" 
  3580.   "*
  3581. {
  3582.   CC_STATUS_INIT;
  3583.   return \"clr%.w %0\;swap %0\";
  3584. }")
  3585.  
  3586. ;; On the 68000, this makes faster code in a special case.
  3587.  
  3588. (define_insn ""
  3589.   [(set (match_operand:SI 0 "register_operand" "=d")
  3590.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
  3591.              (match_operand:SI 2 "immediate_operand" "i")))]
  3592.   "(! TARGET_68020 && GET_CODE (operands[2]) == CONST_INT
  3593.     && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
  3594.   "*
  3595. {
  3596.   /* I think lsr%.w sets the CC properly.  */
  3597.   operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
  3598.   return \"clr%.w %0\;swap %0\;lsr%.w %2,%0\";
  3599. }")
  3600.  
  3601. (define_insn "lshrsi3"
  3602.   [(set (match_operand:SI 0 "register_operand" "=d")
  3603.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
  3604.              (match_operand:SI 2 "general_operand" "dI")))]
  3605.   ""
  3606.   "*
  3607. {
  3608.   return \"lsr%.l %2,%0\";
  3609. }")
  3610.  
  3611. (define_insn "lshrhi3"
  3612.   [(set (match_operand:HI 0 "register_operand" "=d")
  3613.     (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
  3614.              (match_operand:HI 2 "general_operand" "dI")))]
  3615.   ""
  3616.   "lsr%.w %2,%0")
  3617.  
  3618. (define_insn ""
  3619.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  3620.     (lshiftrt:HI (match_dup 0)
  3621.              (match_operand:HI 1 "general_operand" "dI")))]
  3622.   ""
  3623.   "lsr%.w %1,%0")
  3624.  
  3625. (define_insn "lshrqi3"
  3626.   [(set (match_operand:QI 0 "register_operand" "=d")
  3627.     (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
  3628.              (match_operand:QI 2 "general_operand" "dI")))]
  3629.   ""
  3630.   "lsr%.b %2,%0")
  3631.  
  3632. (define_insn ""
  3633.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  3634.     (lshiftrt:QI (match_dup 0)
  3635.              (match_operand:QI 1 "general_operand" "dI")))]
  3636.   ""
  3637.   "lsr%.b %1,%0")
  3638.  
  3639. ;; rotate instructions
  3640.  
  3641. (define_insn "rotlsi3"
  3642.   [(set (match_operand:SI 0 "register_operand" "=d")
  3643.     (rotate:SI (match_operand:SI 1 "register_operand" "0")
  3644.            (match_operand:SI 2 "general_operand" "dI")))]
  3645.   ""
  3646.   "rol%.l %2,%0")
  3647.  
  3648. (define_insn "rotlhi3"
  3649.   [(set (match_operand:HI 0 "register_operand" "=d")
  3650.     (rotate:HI (match_operand:HI 1 "register_operand" "0")
  3651.            (match_operand:HI 2 "general_operand" "dI")))]
  3652.   ""
  3653.   "rol%.w %2,%0")
  3654.  
  3655.  
  3656. (define_insn ""
  3657.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  3658.     (rotate:HI (match_dup 0)
  3659.            (match_operand:HI 1 "general_operand" "dI")))]
  3660.   ""
  3661.   "rol%.w %1,%0")
  3662.  
  3663. (define_insn "rotlqi3"
  3664.   [(set (match_operand:QI 0 "register_operand" "=d")
  3665.     (rotate:QI (match_operand:QI 1 "register_operand" "0")
  3666.            (match_operand:QI 2 "general_operand" "dI")))]
  3667.   ""
  3668.   "rol%.b %2,%0")
  3669.  
  3670. (define_insn ""
  3671.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  3672.     (rotate:QI (match_dup 0)
  3673.            (match_operand:QI 1 "general_operand" "dI")))]
  3674.   ""
  3675.   "rol%.b %1,%0")
  3676.  
  3677. (define_insn "rotrsi3"
  3678.   [(set (match_operand:SI 0 "register_operand" "=d")
  3679.     (rotatert:SI (match_operand:SI 1 "register_operand" "0")
  3680.              (match_operand:SI 2 "general_operand" "dI")))]
  3681.   ""
  3682.   "ror%.l %2,%0")
  3683.  
  3684. (define_insn "rotrhi3"
  3685.   [(set (match_operand:HI 0 "register_operand" "=d")
  3686.     (rotatert:HI (match_operand:HI 1 "register_operand" "0")
  3687.              (match_operand:HI 2 "general_operand" "dI")))]
  3688.   ""
  3689.   "ror%.w %2,%0")
  3690.  
  3691. (define_insn ""
  3692.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  3693.     (rotatert:HI (match_dup 0)
  3694.              (match_operand:HI 1 "general_operand" "dI")))]
  3695.   ""
  3696.   "ror%.w %1,%0")
  3697.  
  3698. (define_insn "rotrqi3"
  3699.   [(set (match_operand:QI 0 "register_operand" "=d")
  3700.     (rotatert:QI (match_operand:QI 1 "register_operand" "0")
  3701.              (match_operand:QI 2 "general_operand" "dI")))]
  3702.   ""
  3703.   "ror%.b %2,%0")
  3704.  
  3705. (define_insn ""
  3706.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  3707.     (rotatert:QI (match_dup 0)
  3708.              (match_operand:QI 1 "general_operand" "dI")))]
  3709.   ""
  3710.   "ror%.b %1,%0")
  3711.  
  3712. ;; Special cases of bit-field insns which we should
  3713. ;; recognize in preference to the general case.
  3714. ;; These handle aligned 8-bit and 16-bit fields,
  3715. ;; which can usually be done with move instructions.
  3716.  
  3717. ;
  3718. ; Special case for 32-bit field in memory.  This only occurs when 32-bit
  3719. ; alignment of structure members is specified.
  3720. ;
  3721. ; The move is allowed to be odd byte aligned, because that's still faster
  3722. ; than an odd byte aligned bit field instruction.
  3723. ;
  3724. (define_insn ""
  3725.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o")
  3726.              (match_operand:SI 1 "immediate_operand" "i")
  3727.              (match_operand:SI 2 "immediate_operand" "i"))
  3728.     (match_operand:SI 3 "general_operand" "rmi"))]
  3729.   "TARGET_68020 && TARGET_BITFIELD
  3730.    && GET_CODE (operands[1]) == CONST_INT
  3731.    && (INTVAL (operands[1]) == 32)
  3732.    && GET_CODE (operands[2]) == CONST_INT
  3733.    && (INTVAL (operands[2]) % 8) == 0
  3734.    && ! mode_dependent_address_p (XEXP (operands[0], 0))"
  3735.   "*
  3736. {
  3737.   operands[0]
  3738.     = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
  3739.  
  3740.   return \"move%.l %3,%0\";
  3741. }")
  3742.  
  3743. (define_insn ""
  3744.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+do")
  3745.              (match_operand:SI 1 "immediate_operand" "i")
  3746.              (match_operand:SI 2 "immediate_operand" "i"))
  3747.     (match_operand:SI 3 "general_operand" "d"))]
  3748.   "TARGET_68020 && TARGET_BITFIELD
  3749.    && GET_CODE (operands[1]) == CONST_INT
  3750.    && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
  3751.    && GET_CODE (operands[2]) == CONST_INT
  3752.    && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
  3753.    && (GET_CODE (operands[0]) == REG
  3754.        || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
  3755.   "*
  3756. {
  3757.   if (REG_P (operands[0]))
  3758.     {
  3759.       if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
  3760.         return \"bfins %3,%0{%b2:%b1}\";
  3761.     }
  3762.   else
  3763.     operands[0]
  3764.       = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
  3765.  
  3766.   if (GET_CODE (operands[3]) == MEM)
  3767.     operands[3] = adj_offsettable_operand (operands[3],
  3768.                        (32 - INTVAL (operands[1])) / 8);
  3769.   if (INTVAL (operands[1]) == 8)
  3770.     return \"move%.b %3,%0\";
  3771.   return \"move%.w %3,%0\";
  3772. }")
  3773.  
  3774.  
  3775. ;
  3776. ; Special case for 32-bit field in memory.  This only occurs when 32-bit
  3777. ; alignment of structure members is specified.
  3778. ;
  3779. ; The move is allowed to be odd byte aligned, because that's still faster
  3780. ; than an odd byte aligned bit field instruction.
  3781. ;
  3782. (define_insn ""
  3783.   [(set (match_operand:SI 0 "general_operand" "=rm")
  3784.     (zero_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o")
  3785.              (match_operand:SI 2 "immediate_operand" "i")
  3786.              (match_operand:SI 3 "immediate_operand" "i")))]
  3787.   "TARGET_68020 && TARGET_BITFIELD
  3788.    && GET_CODE (operands[2]) == CONST_INT
  3789.    && (INTVAL (operands[2]) == 32)
  3790.    && GET_CODE (operands[3]) == CONST_INT
  3791.    && (INTVAL (operands[3]) % 8) == 0
  3792.    && ! mode_dependent_address_p (XEXP (operands[1], 0))"
  3793.   "*
  3794. {
  3795.   operands[1]
  3796.     = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  3797.  
  3798.   return \"move%.l %1,%0\";
  3799. }")
  3800.  
  3801. (define_insn ""
  3802.   [(set (match_operand:SI 0 "general_operand" "=&d")
  3803.     (zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do")
  3804.              (match_operand:SI 2 "immediate_operand" "i")
  3805.              (match_operand:SI 3 "immediate_operand" "i")))]
  3806.   "TARGET_68020 && TARGET_BITFIELD
  3807.    && GET_CODE (operands[2]) == CONST_INT
  3808.    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
  3809.    && GET_CODE (operands[3]) == CONST_INT
  3810.    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
  3811.    && (GET_CODE (operands[1]) == REG
  3812.        || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
  3813.   "*
  3814. {
  3815.   cc_status.flags |= CC_NOT_NEGATIVE;
  3816.   if (REG_P (operands[1]))
  3817.     {
  3818.       if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
  3819.     return \"bfextu %1{%b3:%b2},%0\";
  3820.     }
  3821.   else
  3822.     operands[1]
  3823.       = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  3824.  
  3825.   output_asm_insn (\"clr%.l %0\", operands);
  3826.   if (GET_CODE (operands[0]) == MEM)
  3827.     operands[0] = adj_offsettable_operand (operands[0],
  3828.                        (32 - INTVAL (operands[1])) / 8);
  3829.   if (INTVAL (operands[2]) == 8)
  3830.     return \"move%.b %1,%0\";
  3831.   return \"move%.w %1,%0\";
  3832. }")
  3833.  
  3834. ;
  3835. ; Special case for 32-bit field in memory.  This only occurs when 32-bit
  3836. ; alignment of structure members is specified.
  3837. ;
  3838. ; The move is allowed to be odd byte aligned, because that's still faster
  3839. ; than an odd byte aligned bit field instruction.
  3840. ;
  3841. (define_insn ""
  3842.   [(set (match_operand:SI 0 "general_operand" "=rm")
  3843.     (sign_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o")
  3844.              (match_operand:SI 2 "immediate_operand" "i")
  3845.              (match_operand:SI 3 "immediate_operand" "i")))]
  3846.   "TARGET_68020 && TARGET_BITFIELD
  3847.    && GET_CODE (operands[2]) == CONST_INT
  3848.    && (INTVAL (operands[2]) == 32)
  3849.    && GET_CODE (operands[3]) == CONST_INT
  3850.    && (INTVAL (operands[3]) % 8) == 0
  3851.    && ! mode_dependent_address_p (XEXP (operands[1], 0))"
  3852.   "*
  3853. {
  3854.   operands[1]
  3855.     = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  3856.  
  3857.   return \"move%.l %1,%0\";
  3858. }")
  3859.  
  3860. (define_insn ""
  3861.   [(set (match_operand:SI 0 "general_operand" "=d")
  3862.     (sign_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do")
  3863.              (match_operand:SI 2 "immediate_operand" "i")
  3864.              (match_operand:SI 3 "immediate_operand" "i")))]
  3865.   "TARGET_68020 && TARGET_BITFIELD
  3866.    && GET_CODE (operands[2]) == CONST_INT
  3867.    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
  3868.    && GET_CODE (operands[3]) == CONST_INT
  3869.    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
  3870.    && (GET_CODE (operands[1]) == REG
  3871.        || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
  3872.   "*
  3873. {
  3874.   if (REG_P (operands[1]))
  3875.     {
  3876.       if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
  3877.     return \"bfexts %1{%b3:%b2},%0\";
  3878.     }
  3879.   else
  3880.     operands[1]
  3881.       = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  3882.  
  3883.   if (INTVAL (operands[2]) == 8)
  3884.     return \"move%.b %1,%0\;extb%.l %0\";
  3885.   return \"move%.w %1,%0\;ext%.l %0\";
  3886. }")
  3887.  
  3888. ;; Bit field instructions, general cases.
  3889. ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
  3890. ;; so that its address is reloaded.
  3891.  
  3892. (define_insn "extv"
  3893.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  3894.     (sign_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o,d")
  3895.              (match_operand:SI 2 "general_operand" "di,di")
  3896.              (match_operand:SI 3 "general_operand" "di,di")))]
  3897.   "TARGET_68020 && TARGET_BITFIELD"
  3898.   "bfexts %1{%b3:%b2},%0")
  3899.  
  3900. (define_insn "extzv"
  3901.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  3902.     (zero_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o,d")
  3903.              (match_operand:SI 2 "general_operand" "di,di")
  3904.              (match_operand:SI 3 "general_operand" "di,di")))]
  3905.   "TARGET_68020 && TARGET_BITFIELD"
  3906.   "*
  3907. {
  3908.   cc_status.flags |= CC_NOT_NEGATIVE;
  3909.   return \"bfextu %1{%b3:%b2},%0\";
  3910. }")
  3911.  
  3912. (define_insn ""
  3913.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  3914.              (match_operand:SI 1 "general_operand" "di,di")
  3915.              (match_operand:SI 2 "general_operand" "di,di"))
  3916.         (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
  3917.         (match_operand 3 "immediate_operand" "i,i")))]
  3918.   "TARGET_68020 && TARGET_BITFIELD
  3919.    && GET_CODE (operands[3]) == CONST_INT
  3920.    && (INTVAL (operands[3]) == -1
  3921.        || (GET_CODE (operands[1]) == CONST_INT
  3922.            && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
  3923.   "*
  3924. {
  3925.   CC_STATUS_INIT;
  3926.   return \"bfchg %0{%b2:%b1}\";
  3927. }")
  3928.  
  3929. (define_insn ""
  3930.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  3931.              (match_operand:SI 1 "general_operand" "di,di")
  3932.              (match_operand:SI 2 "general_operand" "di,di"))
  3933.     (const_int 0))]
  3934.   "TARGET_68020 && TARGET_BITFIELD"
  3935.   "*
  3936. {
  3937.   CC_STATUS_INIT;
  3938.   return \"bfclr %0{%b2:%b1}\";
  3939. }")
  3940.  
  3941. (define_insn ""
  3942.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  3943.              (match_operand:SI 1 "general_operand" "di,di")
  3944.              (match_operand:SI 2 "general_operand" "di,di"))
  3945.     (const_int -1))]
  3946.   "TARGET_68020 && TARGET_BITFIELD"
  3947.   "*
  3948. {
  3949.   CC_STATUS_INIT;
  3950.   return \"bfset %0{%b2:%b1}\";
  3951. }")
  3952.  
  3953. (define_insn "insv"
  3954.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  3955.              (match_operand:SI 1 "general_operand" "di,di")
  3956.              (match_operand:SI 2 "general_operand" "di,di"))
  3957.     (match_operand:SI 3 "general_operand" "d,d"))]
  3958.   "TARGET_68020 && TARGET_BITFIELD"
  3959.   "bfins %3,%0{%b2:%b1}")
  3960.  
  3961. ;; Now recognize bit field insns that operate on registers
  3962. ;; (or at least were intended to do so).
  3963.  
  3964. (define_insn ""
  3965.   [(set (match_operand:SI 0 "general_operand" "=d")
  3966.     (sign_extract:SI (match_operand:SI 1 "nonimmediate_operand" "d")
  3967.              (match_operand:SI 2 "general_operand" "di")
  3968.              (match_operand:SI 3 "general_operand" "di")))]
  3969.   "TARGET_68020 && TARGET_BITFIELD"
  3970.   "bfexts %1{%b3:%b2},%0")
  3971.  
  3972. (define_insn ""
  3973.   [(set (match_operand:SI 0 "general_operand" "=d")
  3974.     (zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "d")
  3975.              (match_operand:SI 2 "general_operand" "di")
  3976.              (match_operand:SI 3 "general_operand" "di")))]
  3977.   "TARGET_68020 && TARGET_BITFIELD"
  3978.   "*
  3979. {
  3980.   cc_status.flags |= CC_NOT_NEGATIVE;
  3981.   return \"bfextu %1{%b3:%b2},%0\";
  3982. }")
  3983.  
  3984. (define_insn ""
  3985.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  3986.              (match_operand:SI 1 "general_operand" "di")
  3987.              (match_operand:SI 2 "general_operand" "di"))
  3988.     (const_int 0))]
  3989.   "TARGET_68020 && TARGET_BITFIELD"
  3990.   "*
  3991. {
  3992.   CC_STATUS_INIT;
  3993.   return \"bfclr %0{%b2:%b1}\";
  3994. }")
  3995.  
  3996. (define_insn ""
  3997.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  3998.              (match_operand:SI 1 "general_operand" "di")
  3999.              (match_operand:SI 2 "general_operand" "di"))
  4000.     (const_int -1))]
  4001.   "TARGET_68020 && TARGET_BITFIELD"
  4002.   "*
  4003. {
  4004.   CC_STATUS_INIT;
  4005.   return \"bfset %0{%b2:%b1}\";
  4006. }")
  4007.  
  4008. (define_insn ""
  4009.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  4010.              (match_operand:SI 1 "general_operand" "di")
  4011.              (match_operand:SI 2 "general_operand" "di"))
  4012.     (match_operand:SI 3 "general_operand" "d"))]
  4013.   "TARGET_68020 && TARGET_BITFIELD"
  4014.   "*
  4015. {
  4016. #if 0
  4017.   /* These special cases are now recognized by a specific pattern.  */
  4018.   if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
  4019.       && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
  4020.     return \"move%.w %3,%0\";
  4021.   if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
  4022.       && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
  4023.     return \"move%.b %3,%0\";
  4024. #endif
  4025.   return \"bfins %3,%0{%b2:%b1}\";
  4026. }")
  4027.  
  4028. ;; Special patterns for optimizing bit-field instructions.
  4029.  
  4030. (define_insn ""
  4031.   [(set (cc0)
  4032.     (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
  4033.              (match_operand:SI 1 "general_operand" "di")
  4034.              (match_operand:SI 2 "general_operand" "di")))]
  4035.   "TARGET_68020 && TARGET_BITFIELD
  4036.    && GET_CODE (operands[1]) == CONST_INT"
  4037.   "*
  4038. {
  4039.   if (operands[1] == const1_rtx
  4040.       && GET_CODE (operands[2]) == CONST_INT)
  4041.     {    
  4042.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  4043.       return output_btst (operands,
  4044.               gen_rtx (CONST_INT, VOIDmode,
  4045.                    width - INTVAL (operands[2])),
  4046.               operands[0],
  4047.               insn, 1000);
  4048.       /* Pass 1000 as SIGNPOS argument so that btst will
  4049.          not think we are testing the sign bit for an `and'
  4050.      and assume that nonzero implies a negative result.  */
  4051.     }
  4052.   if (INTVAL (operands[1]) != 32)
  4053.     cc_status.flags = CC_NOT_NEGATIVE;
  4054.   return \"bftst %0{%b2:%b1}\";
  4055. }")
  4056.  
  4057.   
  4058. ;;; now handle the register cases
  4059. (define_insn ""
  4060.   [(set (cc0)
  4061.     (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "d")
  4062.              (match_operand:SI 1 "general_operand" "di")
  4063.              (match_operand:SI 2 "general_operand" "di")))]
  4064.   "TARGET_68020 && TARGET_BITFIELD
  4065.    && GET_CODE (operands[1]) == CONST_INT"
  4066.   "*
  4067. {
  4068.   if (operands[1] == const1_rtx
  4069.       && GET_CODE (operands[2]) == CONST_INT)
  4070.     {    
  4071.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  4072.       return output_btst (operands,
  4073.               gen_rtx (CONST_INT, VOIDmode,
  4074.                    width - INTVAL (operands[2])),
  4075.               operands[0],
  4076.               insn, 1000);
  4077.       /* Pass 1000 as SIGNPOS argument so that btst will
  4078.          not think we are testing the sign bit for an `and'
  4079.      and assume that nonzero implies a negative result.  */
  4080.     }
  4081.   if (INTVAL (operands[1]) != 32)
  4082.     cc_status.flags = CC_NOT_NEGATIVE;
  4083.   return \"bftst %0{%b2:%b1}\";
  4084. }")
  4085.  
  4086. (define_insn "seq"
  4087.   [(set (match_operand:QI 0 "general_operand" "=d")
  4088.     (eq:QI (cc0) (const_int 0)))]
  4089.   ""
  4090.   "*
  4091.   cc_status = cc_prev_status;
  4092.   OUTPUT_JUMP (\"seq %0\", \"fseq %0\", \"seq %0\");
  4093. ")
  4094.  
  4095. (define_insn "sne"
  4096.   [(set (match_operand:QI 0 "general_operand" "=d")
  4097.     (ne:QI (cc0) (const_int 0)))]
  4098.   ""
  4099.   "*
  4100.   cc_status = cc_prev_status;
  4101.   OUTPUT_JUMP (\"sne %0\", \"fsne %0\", \"sne %0\");
  4102. ")
  4103.  
  4104. (define_insn "sgt"
  4105.   [(set (match_operand:QI 0 "general_operand" "=d")
  4106.     (gt:QI (cc0) (const_int 0)))]
  4107.   ""
  4108.   "*
  4109.   cc_status = cc_prev_status;
  4110.   OUTPUT_JUMP (\"sgt %0\", \"fsgt %0\", 0);
  4111. ")
  4112.  
  4113. (define_insn "sgtu"
  4114.   [(set (match_operand:QI 0 "general_operand" "=d")
  4115.     (gtu:QI (cc0) (const_int 0)))]
  4116.   ""
  4117.   "* cc_status = cc_prev_status;
  4118.      return \"shi %0\"; ")
  4119.  
  4120. (define_insn "slt"
  4121.   [(set (match_operand:QI 0 "general_operand" "=d")
  4122.     (lt:QI (cc0) (const_int 0)))]
  4123.   ""
  4124.   "* cc_status = cc_prev_status;
  4125.      OUTPUT_JUMP (\"slt %0\", \"fslt %0\", \"smi %0\"); ")
  4126.  
  4127. (define_insn "sltu"
  4128.   [(set (match_operand:QI 0 "general_operand" "=d")
  4129.     (ltu:QI (cc0) (const_int 0)))]
  4130.   ""
  4131.   "* cc_status = cc_prev_status;
  4132.      return \"scs %0\"; ")
  4133.  
  4134. (define_insn "sge"
  4135.   [(set (match_operand:QI 0 "general_operand" "=d")
  4136.     (ge:QI (cc0) (const_int 0)))]
  4137.   ""
  4138.   "* cc_status = cc_prev_status;
  4139.      OUTPUT_JUMP (\"sge %0\", \"fsge %0\", \"spl %0\"); ")
  4140.  
  4141. (define_insn "sgeu"
  4142.   [(set (match_operand:QI 0 "general_operand" "=d")
  4143.     (geu:QI (cc0) (const_int 0)))]
  4144.   ""
  4145.   "* cc_status = cc_prev_status;
  4146.      return \"scc %0\"; ")
  4147.  
  4148. (define_insn "sle"
  4149.   [(set (match_operand:QI 0 "general_operand" "=d")
  4150.     (le:QI (cc0) (const_int 0)))]
  4151.   ""
  4152.   "*
  4153.   cc_status = cc_prev_status;
  4154.   OUTPUT_JUMP (\"sle %0\", \"fsle %0\", 0);
  4155. ")
  4156.  
  4157. (define_insn "sleu"
  4158.   [(set (match_operand:QI 0 "general_operand" "=d")
  4159.     (leu:QI (cc0) (const_int 0)))]
  4160.   ""
  4161.   "* cc_status = cc_prev_status;
  4162.      return \"sls %0\"; ")
  4163.  
  4164. ;; Basic conditional jump instructions.
  4165.  
  4166. (define_insn "beq"
  4167.   [(set (pc)
  4168.     (if_then_else (eq (cc0)
  4169.               (const_int 0))
  4170.               (label_ref (match_operand 0 "" ""))
  4171.               (pc)))]
  4172.   ""
  4173.   "*
  4174. {
  4175. #ifdef MOTOROLA
  4176. #ifdef MPW_ASM
  4177.   OUTPUT_JUMP (\"beq %l0\", \"fbeq %l0\", \"beq %l0\");
  4178. #else
  4179.   OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
  4180. #endif
  4181. #else
  4182.   OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
  4183. #endif
  4184. }")
  4185.  
  4186. (define_insn "bne"
  4187.   [(set (pc)
  4188.     (if_then_else (ne (cc0)
  4189.               (const_int 0))
  4190.               (label_ref (match_operand 0 "" ""))
  4191.               (pc)))]
  4192.   ""
  4193.   "*
  4194. {
  4195. #ifdef MOTOROLA
  4196. #ifdef MPW_ASM
  4197.   OUTPUT_JUMP (\"bne %l0\", \"fbne %l0\", \"bne %l0\");
  4198. #else
  4199.   OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
  4200. #endif
  4201. #else
  4202.   OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
  4203. #endif
  4204. }")
  4205.  
  4206. (define_insn "bgt"
  4207.   [(set (pc)
  4208.     (if_then_else (gt (cc0)
  4209.               (const_int 0))
  4210.               (label_ref (match_operand 0 "" ""))
  4211.               (pc)))]
  4212.   ""
  4213.   "*
  4214. #ifdef MOTOROLA
  4215. #ifdef MPW_ASM
  4216.   OUTPUT_JUMP (\"bgt %l0\", \"fbgt %l0\", 0);
  4217. #else
  4218.   OUTPUT_JUMP (\"jbgt %l0\", \"fbgt %l0\", 0);
  4219. #endif
  4220. #else
  4221.   OUTPUT_JUMP (\"jgt %l0\", \"fjgt %l0\", 0);
  4222. #endif
  4223. ")
  4224.  
  4225. (define_insn "bgtu"
  4226.   [(set (pc)
  4227.     (if_then_else (gtu (cc0)
  4228.                (const_int 0))
  4229.               (label_ref (match_operand 0 "" ""))
  4230.               (pc)))]
  4231.   ""
  4232.   "*
  4233. #ifdef MOTOROLA
  4234. #ifdef MPW_ASM
  4235.   return \"bhi %l0\";
  4236. #else
  4237.   return \"jbhi %l0\";
  4238. #endif
  4239. #else
  4240.   return \"jhi %l0\";
  4241. #endif
  4242. ")
  4243.  
  4244. (define_insn "blt"
  4245.   [(set (pc)
  4246.     (if_then_else (lt (cc0)
  4247.               (const_int 0))
  4248.               (label_ref (match_operand 0 "" ""))
  4249.               (pc)))]
  4250.   ""
  4251.   "*
  4252. #ifdef MOTOROLA
  4253. #ifdef MPW_ASM
  4254.   OUTPUT_JUMP (\"blt %l0\", \"fblt %l0\", \"bmi %l0\");
  4255. #else
  4256.   OUTPUT_JUMP (\"jblt %l0\", \"fblt %l0\", \"jbmi %l0\");
  4257. #endif
  4258. #else
  4259.   OUTPUT_JUMP (\"jlt %l0\", \"fjlt %l0\", \"jmi %l0\");
  4260. #endif
  4261. ")
  4262.  
  4263. (define_insn "bltu"
  4264.   [(set (pc)
  4265.     (if_then_else (ltu (cc0)
  4266.                (const_int 0))
  4267.               (label_ref (match_operand 0 "" ""))
  4268.               (pc)))]
  4269.   ""
  4270.   "*
  4271. #ifdef MOTOROLA
  4272. #ifdef MPW_ASM
  4273.   return \"bcs %l0\";
  4274. #else
  4275.   return \"jbcs %l0\";
  4276. #endif
  4277. #else
  4278.   return \"jcs %l0\";
  4279. #endif
  4280. ")
  4281.  
  4282. (define_insn "bge"
  4283.   [(set (pc)
  4284.     (if_then_else (ge (cc0)
  4285.               (const_int 0))
  4286.               (label_ref (match_operand 0 "" ""))
  4287.               (pc)))]
  4288.   ""
  4289.   "*
  4290. #ifdef MOTOROLA
  4291. #ifdef MPW_ASM
  4292.   OUTPUT_JUMP (\"bge %l0\", \"fbge %l0\", \"bpl %l0\");
  4293. #else
  4294.   OUTPUT_JUMP (\"jbge %l0\", \"fbge %l0\", \"jbpl %l0\");
  4295. #endif
  4296. #else
  4297.   OUTPUT_JUMP (\"jge %l0\", \"fjge %l0\", \"jpl %l0\");
  4298. #endif
  4299. ")
  4300.  
  4301. (define_insn "bgeu"
  4302.   [(set (pc)
  4303.     (if_then_else (geu (cc0)
  4304.                (const_int 0))
  4305.               (label_ref (match_operand 0 "" ""))
  4306.               (pc)))]
  4307.   ""
  4308.   "*
  4309. #ifdef MOTOROLA
  4310. #ifdef MPW_ASM
  4311.   return \"bcc %l0\";
  4312. #else
  4313.   return \"jbcc %l0\";
  4314. #endif
  4315. #else
  4316.   return \"jcc %l0\";
  4317. #endif
  4318. ")
  4319.  
  4320. (define_insn "ble"
  4321.   [(set (pc)
  4322.     (if_then_else (le (cc0)
  4323.               (const_int 0))
  4324.               (label_ref (match_operand 0 "" ""))
  4325.               (pc)))]
  4326.   ""
  4327.   "*
  4328. #ifdef MOTOROLA
  4329. #ifdef MPW_ASM
  4330.   OUTPUT_JUMP (\"ble %l0\", \"fble %l0\", 0);
  4331. #else
  4332.   OUTPUT_JUMP (\"jble %l0\", \"fble %l0\", 0);
  4333. #endif
  4334. #else
  4335.   OUTPUT_JUMP (\"jle %l0\", \"fjle %l0\", 0);
  4336. #endif
  4337. ")
  4338.  
  4339. (define_insn "bleu"
  4340.   [(set (pc)
  4341.     (if_then_else (leu (cc0)
  4342.                (const_int 0))
  4343.               (label_ref (match_operand 0 "" ""))
  4344.               (pc)))]
  4345.   ""
  4346.   "*
  4347. #ifdef MOTOROLA
  4348. #ifdef MPW_ASM
  4349.   return \"bls %l0\";
  4350. #else
  4351.   return \"jbls %l0\";
  4352. #endif
  4353. #else
  4354.   return \"jls %l0\";
  4355. #endif
  4356. ")
  4357.  
  4358. ;; Negated conditional jump instructions.
  4359.  
  4360. (define_insn ""
  4361.   [(set (pc)
  4362.     (if_then_else (eq (cc0)
  4363.               (const_int 0))
  4364.               (pc)
  4365.               (label_ref (match_operand 0 "" ""))))]
  4366.   ""
  4367.   "*
  4368. {
  4369. #ifdef MOTOROLA
  4370. #ifdef MPW_ASM
  4371.   OUTPUT_JUMP (\"bne %l0\", \"fbne %l0\", \"bne %l0\");
  4372. #else
  4373.   OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
  4374. #endif
  4375. #else
  4376.   OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
  4377. #endif
  4378. }")
  4379.  
  4380. (define_insn ""
  4381.   [(set (pc)
  4382.     (if_then_else (ne (cc0)
  4383.               (const_int 0))
  4384.               (pc)
  4385.               (label_ref (match_operand 0 "" ""))))]
  4386.   ""
  4387.   "*
  4388. {
  4389. #ifdef MOTOROLA
  4390. #ifdef MPW_ASM
  4391.   OUTPUT_JUMP (\"beq %l0\", \"fbeq %l0\", \"beq %l0\");
  4392. #else
  4393.   OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
  4394. #endif
  4395. #else
  4396.   OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
  4397. #endif
  4398. }")
  4399.  
  4400. (define_insn ""
  4401.   [(set (pc)
  4402.     (if_then_else (gt (cc0)
  4403.               (const_int 0))
  4404.               (pc)
  4405.               (label_ref (match_operand 0 "" ""))))]
  4406.   ""
  4407.   "*
  4408. #ifdef MOTOROLA
  4409. #ifdef MPW_ASM
  4410.   OUTPUT_JUMP (\"ble %l0\", \"fbngt %l0\", 0);
  4411. #else
  4412.   OUTPUT_JUMP (\"jble %l0\", \"fbngt %l0\", 0);
  4413. #endif
  4414. #else
  4415.   OUTPUT_JUMP (\"jle %l0\", \"fjngt %l0\", 0);
  4416. #endif
  4417. ")
  4418.  
  4419. (define_insn ""
  4420.   [(set (pc)
  4421.     (if_then_else (gtu (cc0)
  4422.                (const_int 0))
  4423.               (pc)
  4424.               (label_ref (match_operand 0 "" ""))))]
  4425.   ""
  4426.   "*
  4427. #ifdef MOTOROLA
  4428. #ifdef MPW_ASM
  4429.   return \"bls %l0\";
  4430. #else
  4431.   return \"jbls %l0\";
  4432. #endif
  4433. #else
  4434.   return \"jls %l0\";
  4435. #endif
  4436. ")
  4437.  
  4438. (define_insn ""
  4439.   [(set (pc)
  4440.     (if_then_else (lt (cc0)
  4441.               (const_int 0))
  4442.               (pc)
  4443.               (label_ref (match_operand 0 "" ""))))]
  4444.   ""
  4445.   "*
  4446. #ifdef MOTOROLA
  4447. #ifdef MPW_ASM
  4448.   OUTPUT_JUMP (\"bge %l0\", \"fbnlt %l0\", \"bpl %l0\");
  4449. #else
  4450.   OUTPUT_JUMP (\"jbge %l0\", \"fbnlt %l0\", \"jbpl %l0\");
  4451. #endif
  4452. #else
  4453.   OUTPUT_JUMP (\"jge %l0\", \"fjnlt %l0\", \"jpl %l0\");
  4454. #endif
  4455. ")
  4456.  
  4457. (define_insn ""
  4458.   [(set (pc)
  4459.     (if_then_else (ltu (cc0)
  4460.                (const_int 0))
  4461.               (pc)
  4462.               (label_ref (match_operand 0 "" ""))))]
  4463.   ""
  4464.   "*
  4465. #ifdef MOTOROLA
  4466. #ifdef MPW_ASM
  4467.   return \"bcc %l0\";
  4468. #else
  4469.   return \"jbcc %l0\";
  4470. #endif
  4471. #else
  4472.   return \"jcc %l0\";
  4473. #endif
  4474. ")
  4475.  
  4476. (define_insn ""
  4477.   [(set (pc)
  4478.     (if_then_else (ge (cc0)
  4479.               (const_int 0))
  4480.               (pc)
  4481.               (label_ref (match_operand 0 "" ""))))]
  4482.   ""
  4483.   "*
  4484. #ifdef MOTOROLA
  4485. #ifdef MPW_ASM
  4486.   OUTPUT_JUMP (\"blt %l0\", \"fbnge %l0\", \"bmi %l0\");
  4487. #else
  4488.   OUTPUT_JUMP (\"jblt %l0\", \"fbnge %l0\", \"jbmi %l0\");
  4489. #endif
  4490. #else
  4491.   OUTPUT_JUMP (\"jlt %l0\", \"fjnge %l0\", \"jmi %l0\");
  4492. #endif
  4493. ")
  4494.  
  4495. (define_insn ""
  4496.   [(set (pc)
  4497.     (if_then_else (geu (cc0)
  4498.                (const_int 0))
  4499.               (pc)
  4500.               (label_ref (match_operand 0 "" ""))))]
  4501.   ""
  4502.   "*
  4503. #ifdef MOTOROLA
  4504. #ifdef MPW_ASM
  4505.   return \"bcs %l0\";
  4506. #else
  4507.   return \"jbcs %l0\";
  4508. #endif
  4509. #else
  4510.   return \"jcs %l0\";
  4511. #endif
  4512. ")
  4513.  
  4514. (define_insn ""
  4515.   [(set (pc)
  4516.     (if_then_else (le (cc0)
  4517.               (const_int 0))
  4518.               (pc)
  4519.               (label_ref (match_operand 0 "" ""))))]
  4520.   ""
  4521.   "*
  4522. #ifdef MOTOROLA
  4523. #ifdef MPW_ASM
  4524.   OUTPUT_JUMP (\"bgt %l0\", \"fbnle %l0\", 0);
  4525. #else
  4526.   OUTPUT_JUMP (\"jbgt %l0\", \"fbnle %l0\", 0);
  4527. #endif
  4528. #else
  4529.   OUTPUT_JUMP (\"jgt %l0\", \"fjnle %l0\", 0);
  4530. #endif
  4531. ")
  4532.  
  4533. (define_insn ""
  4534.   [(set (pc)
  4535.     (if_then_else (leu (cc0)
  4536.                (const_int 0))
  4537.               (pc)
  4538.               (label_ref (match_operand 0 "" ""))))]
  4539.   ""
  4540.   "*
  4541. #ifdef MOTOROLA
  4542. #ifdef MPW_ASM
  4543.   return \"bhi %l0\";
  4544. #else
  4545.   return \"jbhi %l0\";
  4546. #endif
  4547. #else
  4548.   return \"jhi %l0\";
  4549. #endif
  4550. ")
  4551.  
  4552. ;; Unconditional and other jump instructions
  4553. (define_insn "jump"
  4554.   [(set (pc)
  4555.     (label_ref (match_operand 0 "" "")))]
  4556.   ""
  4557.   "*
  4558. #ifdef MOTOROLA
  4559. #ifdef MPW_ASM
  4560.   return \"bra %l0\";
  4561. #else
  4562.   return \"jbra %l0\";
  4563. #endif
  4564. #else
  4565.   return \"jra %l0\";
  4566. #endif
  4567. ")
  4568.  
  4569. ;; We support two different ways of handling dispatch tables.
  4570. ;; The NeXT uses absolute tables, and other machines use relative.
  4571. ;; This define_expand can generate either kind.
  4572. (define_expand "tablejump"
  4573.   [(parallel [(set (pc) (match_operand 0 "" ""))
  4574.           (use (label_ref (match_operand 1 "" "")))])]
  4575.   ""
  4576.   "
  4577. {
  4578. #ifdef CASE_VECTOR_PC_RELATIVE
  4579.     operands[0] = gen_rtx (PLUS, SImode, pc_rtx, operands[0]);
  4580. #endif
  4581. }")
  4582.  
  4583. ;; Jump to variable address from dispatch table of absolute addresses.
  4584. (define_insn ""
  4585.   [(set (pc) (match_operand:SI 0 "register_operand" "a"))
  4586.    (use (label_ref (match_operand 1 "" "")))]
  4587.   ""
  4588.   "*
  4589. #ifdef MOTOROLA
  4590.   return \"jmp (%0)\";
  4591. #else
  4592.   return \"jmp %0@\";
  4593. #endif
  4594. ")
  4595.  
  4596. ;; Jump to variable address from dispatch table of relative addresses.
  4597. (define_insn ""
  4598.   [(set (pc)
  4599.     (plus:SI (pc) (match_operand:HI 0 "register_operand" "r")))
  4600.    (use (label_ref (match_operand 1 "" "")))]
  4601.   ""
  4602.   "*
  4603. #ifdef ASM_RETURN_CASE_JUMP
  4604.  ASM_RETURN_CASE_JUMP;
  4605. #else
  4606. #ifdef SGS
  4607. #ifdef ASM_OUTPUT_CASE_LABEL
  4608.   return \"jmp 6(%%pc,%0.w)\";
  4609. #else
  4610. #ifdef CRDS
  4611.   return \"jmp 2(pc,%0.w)\";
  4612. #else
  4613.   return \"jmp 2(%%pc,%0.w)\";
  4614. #endif  /* end !CRDS */
  4615. #endif
  4616. #else /* not SGS */
  4617. #ifdef MOTOROLA
  4618. #ifdef MPW_ASM
  4619.   if(0/*TARGET_68020*/) { /*THIS WAS NOT HERE BEFORE BUT IT SHOULD HAVE BEEN, BHP*/
  4620.     return \"jmp (2,pc,%0.w)\";
  4621.   } else {
  4622.     return \"jmp %l1(%0.w)\";
  4623.   }
  4624. #else  /* n MPW_ASM */
  4625.   return \"jmp (2,pc,%0.w)\";
  4626. #endif /* n MPW_ASM */
  4627. #else
  4628.   return \"jmp pc@(2,%0:w)\";
  4629. #endif
  4630. #endif
  4631. #endif
  4632. ")
  4633.  
  4634. ;; Decrement-and-branch insns.
  4635. (define_insn ""
  4636.   [(set (pc)
  4637.     (if_then_else
  4638.      (ne (match_operand:HI 0 "general_operand" "+g")
  4639.          (const_int 0))
  4640.      (label_ref (match_operand 1 "" ""))
  4641.      (pc)))
  4642.    (set (match_dup 0)
  4643.     (plus:HI (match_dup 0)
  4644.          (const_int -1)))]
  4645.   ""
  4646.   "*
  4647. {
  4648.   CC_STATUS_INIT;
  4649.   if (DATA_REG_P (operands[0]))
  4650.     return \"dbra %0,%l1\";
  4651.   if (GET_CODE (operands[0]) == MEM)
  4652.     {
  4653. #ifdef MOTOROLA
  4654. #ifdef NO_ADDSUB_Q
  4655.       return \"sub%.w %#1,%0\;jbcc %l1\";
  4656. #else
  4657. #ifdef MPW_ASM
  4658.       return \"subq%.w %#1,%0\;bcc %l1\";
  4659. #else
  4660.       return \"subq%.w %#1,%0\;jbcc %l1\";
  4661. #endif
  4662. #endif
  4663. #else /* not MOTOROLA */
  4664.       return \"subqw %#1,%0\;jcc %l1\";
  4665. #endif
  4666.     }
  4667. #ifdef MOTOROLA
  4668. #ifdef SGS_CMP_ORDER
  4669. #ifdef NO_ADDSUB_Q
  4670.   return \"sub%.w %#1,%0\;cmp%.w %0,%#-1\;jbne %l1\";
  4671. #else
  4672.   return \"subq%.w %#1,%0\;cmp%.w %0,%#-1\;jbne %l1\";
  4673. #endif
  4674. #else /* not SGS_CMP_ORDER */
  4675. #ifdef MPW_ASM
  4676.   return \"subq%.w %#1,%0\;cmp%.w %#-1,%0\;bne %l1\";
  4677. #else
  4678.   return \"subq%.w %#1,%0\;cmp%.w %#-1,%0\;jbne %l1\";
  4679. #endif /* MPW_ASM */
  4680. #endif
  4681. #else /* not MOTOROLA */
  4682.   return \"subqw %#1,%0\;cmpw %#-1,%0\;jne %l1\";
  4683. #endif
  4684. }")
  4685.  
  4686. (define_insn ""
  4687.   [(set (pc)
  4688.     (if_then_else
  4689.      (ne (match_operand:SI 0 "general_operand" "+g")
  4690.          (const_int 0))
  4691.      (label_ref (match_operand 1 "" ""))
  4692.      (pc)))
  4693.    (set (match_dup 0)
  4694.     (plus:SI (match_dup 0)
  4695.          (const_int -1)))]
  4696.   ""
  4697.   "*
  4698. {
  4699.   CC_STATUS_INIT;
  4700. #ifdef MOTOROLA
  4701. #ifdef NO_ADDSUB_Q
  4702.   if (DATA_REG_P (operands[0]))
  4703.     return \"dbra %0,%l1\;clr%.w %0\;sub%.l %#1,%0\;jbcc %l1\";
  4704.   if (GET_CODE (operands[0]) == MEM)
  4705.     return \"sub%.l %#1,%0\;jbcc %l1\";
  4706. #else
  4707.   if (DATA_REG_P (operands[0]))
  4708. #ifdef MPW_ASM
  4709.     return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;bcc %l1\";
  4710. #else
  4711.     return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jbcc %l1\";
  4712. #endif
  4713.   if (GET_CODE (operands[0]) == MEM)
  4714. #ifdef MPW_ASM
  4715.     return \"subq%.l %#1,%0\;bcc %l1\";
  4716. #else
  4717.     return \"subq%.l %#1,%0\;jbcc %l1\";
  4718. #endif
  4719. #endif /* NO_ADDSUB_Q */
  4720. #ifdef SGS_CMP_ORDER
  4721. #ifdef NO_ADDSUB_Q
  4722.   return \"sub.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  4723. #else
  4724.   return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  4725. #endif
  4726. #else /* not SGS_CMP_ORDER */
  4727. #ifdef MPW_ASM
  4728.   return \"subq.l %#1,%0\;cmp.l %#-1,%0\;bne %l1\";
  4729. #else
  4730.   return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
  4731. #endif /* MPW_ASM */
  4732. #endif /* not SGS_CMP_ORDER */
  4733. #else /* not MOTOROLA */
  4734.   if (DATA_REG_P (operands[0]))
  4735.     return \"dbra %0,%l1\;clr%.w %0\;subql %#1,%0\;jcc %l1\";
  4736.   if (GET_CODE (operands[0]) == MEM)
  4737.     return \"subql %#1,%0\;jcc %l1\";
  4738.   return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
  4739. #endif /* not MOTOROLA */
  4740. }")
  4741.  
  4742. ;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
  4743.  
  4744. (define_insn ""
  4745.   [(set (pc)
  4746.     (if_then_else
  4747.       (ge (plus:HI (match_operand:HI 0 "general_operand" "+g")
  4748.                (const_int -1))
  4749.           (const_int 0))
  4750.       (label_ref (match_operand 1 "" ""))
  4751.       (pc)))
  4752.    (set (match_dup 0)
  4753.     (plus:HI (match_dup 0)
  4754.          (const_int -1)))]
  4755.   "find_reg_note (insn, REG_NONNEG, 0)"
  4756.   "*
  4757. {
  4758.   CC_STATUS_INIT;
  4759. #ifdef MOTOROLA
  4760. #ifdef NO_ADDSUB_Q
  4761.   if (DATA_REG_P (operands[0]))
  4762.     return \"dbra %0,%l1\";
  4763.   if (GET_CODE (operands[0]) == MEM)
  4764.     return \"sub%.w %#1,%0\;jbcc %l1\";
  4765. #else
  4766.   if (DATA_REG_P (operands[0]))
  4767.     return \"dbra %0,%l1\";
  4768.   if (GET_CODE (operands[0]) == MEM)
  4769. #ifdef MPW_ASM
  4770.     return \"subq%.w %#1,%0\;bcc %l1\";
  4771. #else
  4772.     return \"subq%.w %#1,%0\;jbcc %l1\";
  4773. #endif
  4774. #endif
  4775. #ifdef SGS_CMP_ORDER
  4776. #ifdef NO_ADDSUB_Q
  4777.   return \"sub.w %#1,%0\;cmp.w %0,%#-1\;jbne %l1\";
  4778. #else
  4779.   return \"subq.w %#1,%0\;cmp.w %0,%#-1\;jbne %l1\";
  4780. #endif
  4781. #else /* not SGS_CMP_ORDER */
  4782. #ifdef MPW_ASM
  4783.   return \"subq.w %#1,%0\;cmp.w %#-1,%0\;bne %l1\";
  4784. #else
  4785.   return \"subq.w %#1,%0\;cmp.w %#-1,%0\;jbne %l1\";
  4786. #endif /* MPW_ASM */
  4787. #endif /* not SGS_CMP_ORDER */
  4788. #else /* not MOTOROLA */
  4789.   if (DATA_REG_P (operands[0]))
  4790.     return \"dbra %0,%l1\";
  4791.   if (GET_CODE (operands[0]) == MEM)
  4792.     return \"subqw %#1,%0\;jcc %l1\";
  4793.   return \"subqw %#1,%0\;cmpw %#-1,%0\;jne %l1\";
  4794. #endif /* not MOTOROLA */
  4795. }")
  4796.  
  4797. (define_insn "decrement_and_branch_until_zero"
  4798.   [(set (pc)
  4799.     (if_then_else
  4800.       (ge (plus:SI (match_operand:SI 0 "general_operand" "+g")
  4801.                (const_int -1))
  4802.           (const_int 0))
  4803.       (label_ref (match_operand 1 "" ""))
  4804.       (pc)))
  4805.    (set (match_dup 0)
  4806.     (plus:SI (match_dup 0)
  4807.          (const_int -1)))]
  4808.   "find_reg_note (insn, REG_NONNEG, 0)"
  4809.   "*
  4810. {
  4811.   CC_STATUS_INIT;
  4812. #ifdef MOTOROLA
  4813. #ifdef NO_ADDSUB_Q
  4814.   if (DATA_REG_P (operands[0]))
  4815.     return \"dbra %0,%l1\;clr%.w %0\;sub%.l %#1,%0\;jbcc %l1\";
  4816.   if (GET_CODE (operands[0]) == MEM)
  4817.     return \"sub%.l %#1,%0\;jbcc %l1\";
  4818. #else
  4819.   if (DATA_REG_P (operands[0]))
  4820. #ifdef MPW_ASM
  4821.     return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;bcc %l1\";
  4822. #else
  4823.     return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jbcc %l1\";
  4824. #endif
  4825.   if (GET_CODE (operands[0]) == MEM)
  4826. #ifdef MPW_ASM
  4827.     return \"subq%.l %#1,%0\;bcc %l1\";
  4828. #else
  4829.     return \"subq%.l %#1,%0\;jbcc %l1\";
  4830. #endif
  4831. #endif
  4832. #ifdef SGS_CMP_ORDER
  4833. #ifdef NO_ADDSUB_Q
  4834.   return \"sub.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  4835. #else
  4836.   return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  4837. #endif
  4838. #else /* not SGS_CMP_ORDER */
  4839. #ifdef MPW_ASM
  4840.   return \"subq.l %#1,%0\;cmp.l %#-1,%0\;bne %l1\";
  4841. #else
  4842.   return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
  4843. #endif
  4844. #endif /* not SGS_CMP_ORDER */
  4845. #else /* not MOTOROLA */
  4846.   if (DATA_REG_P (operands[0]))
  4847.     return \"dbra %0,%l1\;clr%.w %0\;subql %#1,%0\;jcc %l1\";
  4848.   if (GET_CODE (operands[0]) == MEM)
  4849.     return \"subql %#1,%0\;jcc %l1\";
  4850.   return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
  4851. #endif /* not MOTOROLA */
  4852. }")
  4853.  
  4854.  
  4855. ;; PIC calls are handled by loading the address of the function into a 
  4856. ;; register (via movsi), then emitting a register indirect call using
  4857. ;; the "jsr" function call syntax.
  4858. ;;
  4859. ;; It is important to note that the "jsr" syntax is always used for 
  4860. ;; PIC calls, even on machines in which GCC normally uses the "jbsr"
  4861. ;; syntax for non-PIC calls.  This keeps at least 1 assembler (Sun)
  4862. ;; from emitting incorrect code for a PIC call.
  4863. ;;
  4864. ;; We have different patterns for PIC calls and non-PIC calls.  The
  4865. ;; different patterns are only used to choose the right syntax
  4866. ;; ("jsr" vs "jbsr").
  4867.  
  4868. ;; Call subroutine with no return value.
  4869. (define_expand "call"
  4870.   [(call (match_operand:QI 0 "memory_operand" "")
  4871.      (match_operand:SI 1 "general_operand" ""))]
  4872.   ;; Operand 1 not really used on the m68000.
  4873.  
  4874.   ""
  4875.   "
  4876. {
  4877.   if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  4878.     operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  4879.                force_reg (Pmode, XEXP (operands[0], 0)));
  4880. }")
  4881.  
  4882. ;; This is a normal call sequence.
  4883. ;; Changing "o" to "m" for op 0
  4884. (define_insn ""
  4885.   [(call (match_operand:QI 0 "memory_operand" "m")
  4886.      (match_operand:SI 1 "general_operand" "g"))]
  4887.   ;; Operand 1 not really used on the m68000.
  4888.  
  4889.   "! flag_pic"
  4890.   "*
  4891.   char *name;
  4892.  
  4893.   if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  4894.     {
  4895.        name = XSTR (XEXP (operands[0], 0), 0);
  4896.        if (name[0] == ';')
  4897.          {
  4898.            operands[0] = gen_rtx (MEM, QImode,
  4899.                         gen_rtx (SYMBOL_REF, SImode, name+2));
  4900.            return \"DC.W %0\";
  4901.          }
  4902.     }
  4903.   /* A bizarre hack probably no longer of interest anywhere in Apple. */
  4904.   if (TARGET_FX30 && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  4905.     {
  4906.       return \"DC.W $61ff ; bsr.l\;DC.L %0-m#start-*\";
  4907.     }
  4908. #ifdef MOTOROLA
  4909.   return \"jsr %0\";
  4910. #else
  4911.   return \"jbsr %0\";
  4912. #endif
  4913. ")
  4914.  
  4915. ;; This is a PIC call sequence.
  4916. ;; Changing "o" to "m" for op 0
  4917. (define_insn ""
  4918.   [(call (match_operand:QI 0 "memory_operand" "m")
  4919.      (match_operand:SI 1 "general_operand" "g"))]
  4920.   ;; Operand 1 not really used on the m68000.
  4921.  
  4922.   "flag_pic"
  4923.   "*
  4924.   return \"jsr %0\";
  4925. ")
  4926.  
  4927. ;; Call subroutine, returning value in operand 0
  4928. ;; (which must be a hard register).
  4929. ;; See comments before "call" regarding PIC calls.
  4930. (define_expand "call_value"
  4931.   [(set (match_operand 0 "" "")
  4932.     (call (match_operand:QI 1 "memory_operand" "")
  4933.      (match_operand:SI 2 "general_operand" "")))]
  4934.   ;; Operand 2 not really used on the m68000.
  4935.   ""
  4936.   "
  4937. {
  4938.   if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  4939.     operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
  4940.                force_reg (Pmode, XEXP (operands[1], 0)));
  4941. }")
  4942.  
  4943. ;; This is a normal call_value
  4944. ;; Changing "o" to "m" for op 0
  4945. (define_insn ""
  4946.   [(set (match_operand 0 "" "=rf")
  4947.     (call (match_operand:QI 1 "memory_operand" "o")
  4948.           (match_operand:SI 2 "general_operand" "g")))]
  4949.   ;; Operand 2 not really used on the m68000.
  4950.   "! flag_pic"
  4951.   "*
  4952.   /* Before making a jsr, see if we actually have a direct defn instead. */
  4953.   char *name;
  4954.  
  4955.   if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  4956.     {
  4957.       name = XSTR (XEXP (operands[1], 0), 0);
  4958.       /* Detect a direct function definition and output the bytes
  4959.          literally. */
  4960.       if (name[0] == ';')
  4961.         {
  4962.            operands[1] = gen_rtx (MEM, QImode,
  4963.                                   gen_rtx (SYMBOL_REF, SImode, name+2));
  4964.            return \"DC.W %1\";
  4965.      }
  4966.    }
  4967.   if (TARGET_FX30 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  4968.     {
  4969.       return \"DC.W $61ff ; bsr.l\;DC.L %1-m#start-*\";
  4970.     }
  4971. #ifdef MOTOROLA
  4972.   return \"jsr %1\";
  4973. #else
  4974.   return \"jbsr %1\";
  4975. #endif
  4976. ")
  4977.  
  4978. ;; This is a PIC call_value
  4979. ;; Changing "o" to "m" for op 0
  4980. (define_insn ""
  4981.   [(set (match_operand 0 "" "=rf")
  4982.     (call (match_operand:QI 1 "memory_operand" "m")
  4983.           (match_operand:SI 2 "general_operand" "g")))]
  4984.   ;; Operand 2 not really used on the m68000.
  4985.   "flag_pic"
  4986.   "*
  4987.   return \"jsr %1\";
  4988. ")
  4989.  
  4990. (define_insn "nop"
  4991.   [(const_int 0)]
  4992.   ""
  4993.   "nop")
  4994.  
  4995. (define_insn "probe"
  4996.  [(reg:SI 15)]
  4997.  "NEED_PROBE"
  4998.  "*
  4999. {
  5000.   operands[0] = gen_rtx (PLUS, SImode, stack_pointer_rtx,
  5001.              gen_rtx (CONST_INT, VOIDmode, NEED_PROBE));
  5002.   return \"tstl %a0\";
  5003. }")
  5004.  
  5005. ;; Used for frameless functions which save no regs and allocate no locals.
  5006. (define_insn "return"
  5007.   [(return)]
  5008.   "USE_RETURN_INSN"
  5009.   "*
  5010. {
  5011.   if (current_function_pops_args == 0)
  5012.     return \"rts\";
  5013.   operands[0] = gen_rtx (CONST_INT, VOIDmode, current_function_pops_args);
  5014.   return \"rtd %0\";
  5015. }")
  5016.  
  5017. (define_insn "indirect_jump"
  5018.   [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
  5019.   ""
  5020.   "jmp %a0")
  5021.  
  5022. ;; This should not be used unless the add/sub insns can't be.
  5023.  
  5024. (define_insn ""
  5025.   [(set (match_operand:SI 0 "general_operand" "=a")
  5026.     (match_operand:QI 1 "address_operand" "p"))]
  5027.   ""
  5028.   "lea %a1,%0")
  5029.  
  5030. ;; This is the first machine-dependent peephole optimization.
  5031. ;; It is useful when a floating value is returned from a function call
  5032. ;; and then is moved into an FP register.
  5033. ;; But it is mainly intended to test the support for these optimizations.
  5034.  
  5035. (define_peephole
  5036.   [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
  5037.    (set (match_operand:DF 0 "register_operand" "=f")
  5038.     (match_operand:DF 1 "register_operand" "ad"))]
  5039.   "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
  5040.   "*
  5041. {
  5042.   rtx xoperands[2];
  5043.   xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  5044.   output_asm_insn (\"move%.l %1,%@\", xoperands);
  5045.   output_asm_insn (\"move%.l %1,%-\", operands);
  5046.   return \"fmove%.d %+,%0\";
  5047. }
  5048. ")
  5049.  
  5050. ;; Optimize a stack-adjust followed by a push of an argument.
  5051. ;; This is said to happen frequently with -msoft-float
  5052. ;; when there are consecutive library calls.
  5053.  
  5054. (define_peephole
  5055.   [(set (reg:SI 15) (plus:SI (reg:SI 15)
  5056.                  (match_operand:SI 0 "immediate_operand" "n")))
  5057.    (set (match_operand:SF 1 "push_operand" "=m")
  5058.     (match_operand:SF 2 "general_operand" "rmfF"))]
  5059.   "GET_CODE (operands[0]) == CONST_INT && INTVAL (operands[0]) >= 4
  5060.    && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
  5061.   "*
  5062. {
  5063.   if (INTVAL (operands[0]) > 4)
  5064.     {
  5065.       rtx xoperands[2];
  5066.       xoperands[0] = stack_pointer_rtx;
  5067.       xoperands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[0]) - 4);
  5068. #ifndef NO_ADDSUB_Q
  5069.       if (INTVAL (xoperands[1]) <= 8)
  5070.         output_asm_insn (\"addq%.w %1,%0\", xoperands);
  5071.       else if (INTVAL (xoperands[1]) <= 16 && TARGET_68020)
  5072.     {
  5073.       xoperands[1] = gen_rtx (CONST_INT, VOIDmode, 
  5074.                   INTVAL (xoperands[1]) - 8);
  5075.       output_asm_insn (\"addq%.w %#8,%0\;addq%.w %1,%0\", xoperands);
  5076.     }
  5077.       else
  5078. #endif
  5079.         if (INTVAL (xoperands[1]) <= 0x7FFF)
  5080.           output_asm_insn (\"add%.w %1,%0\", xoperands);
  5081.       else
  5082.         output_asm_insn (\"add%.l %1,%0\", xoperands);
  5083.     }
  5084.   if (FP_REG_P (operands[2]))
  5085.     return \"fmove%.s %2,%@\";
  5086.   return \"move%.l %2,%@\";
  5087. }")
  5088.  
  5089. ;; Speed up stack adjust followed by a fullword fixedpoint push.
  5090. ;; BHP - Added the condition against symbol_refs, probably a better solution exists
  5091. (define_peephole
  5092.   [(set (reg:SI 15) (plus:SI (reg:SI 15)
  5093.                  (match_operand:SI 0 "immediate_operand" "n")))
  5094.    (set (match_operand:SI 1 "push_operand" "=m")
  5095.     (match_operand:SI 2 "general_operand" "g"))]
  5096.   "GET_CODE (operands[0]) == CONST_INT && INTVAL (operands[0]) >= 4
  5097.    && ! reg_mentioned_p (stack_pointer_rtx, operands[2])
  5098.    && !(GET_CODE(operands[2]) == SYMBOL_REF)"
  5099.   "*
  5100. {
  5101.   if (INTVAL (operands[0]) > 4)
  5102.     {
  5103.       rtx xoperands[2];
  5104.       xoperands[0] = stack_pointer_rtx;
  5105.       xoperands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[0]) - 4);
  5106. #ifndef NO_ADDSUB_Q
  5107.       if (INTVAL (xoperands[1]) <= 8)
  5108.         output_asm_insn (\"addq%.w %1,%0\", xoperands);
  5109.       else if (INTVAL (xoperands[1]) <= 16 && TARGET_68020)
  5110.     {
  5111.       xoperands[1] = gen_rtx (CONST_INT, VOIDmode, 
  5112.                   INTVAL (xoperands[1]) - 8);
  5113.       output_asm_insn (\"addq%.w %#8,%0\;addq%.w %1,%0\", xoperands);
  5114.     }
  5115.       else
  5116. #endif
  5117.         if (INTVAL (xoperands[1]) <= 0x7FFF)
  5118.           output_asm_insn (\"add%.w %1,%0\", xoperands);
  5119.       else
  5120.         output_asm_insn (\"add%.l %1,%0\", xoperands);
  5121.     }
  5122.   if (operands[2] == const0_rtx)
  5123.     return \"clr%.l %@\";
  5124.   return \"move%.l %2,%@\";
  5125. }")
  5126.  
  5127. ;; Speed up pushing a single byte but leaving four bytes of space.
  5128.  
  5129. (define_peephole
  5130.   [(set (mem:QI (pre_dec:SI (reg:SI 15)))
  5131.     (match_operand:QI 1 "general_operand" "dami"))
  5132.    (set (reg:SI 15) (minus:SI (reg:SI 15) (const_int 2)))]
  5133.   "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
  5134.   "*
  5135. {
  5136.   rtx xoperands[4];
  5137.  
  5138.   if (GET_CODE (operands[1]) == REG)
  5139.     return \"move%.l %1,%-\";
  5140.  
  5141.   xoperands[1] = operands[1];
  5142.   xoperands[2]
  5143.     = gen_rtx (MEM, QImode,
  5144.            gen_rtx (PLUS, VOIDmode, stack_pointer_rtx,
  5145.             gen_rtx (CONST_INT, VOIDmode, 3)));
  5146.   xoperands[3] = stack_pointer_rtx;
  5147.   output_asm_insn (\"subq%.w %#4,%3\;move%.b %1,%2\", xoperands);
  5148.   return \"\";
  5149. }")
  5150.  
  5151. ;; dbCC peepholes
  5152. ;;
  5153. ;; Turns
  5154. ;;   loop:
  5155. ;;           [ ... ]
  5156. ;;           jCC label        ; abnormal loop termination
  5157. ;;           dbra dN, loop    ; normal loop termination
  5158. ;;
  5159. ;; Into
  5160. ;;   loop:
  5161. ;;           [ ... ]
  5162. ;;           dbCC dN, loop
  5163. ;;           jCC label
  5164. ;;
  5165. ;; Which moves the jCC condition outside the inner loop for free.
  5166. ;;
  5167. (define_peephole
  5168.   [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
  5169.                              [(cc0) (const_int 0)])
  5170.                            (label_ref (match_operand 2 "" ""))
  5171.                            (pc)))
  5172.    (parallel
  5173.     [(set (pc)
  5174.       (if_then_else
  5175.         (ge (plus:HI (match_operand:HI 0 "register_operand" "+d")
  5176.                  (const_int -1))
  5177.             (const_int 0))
  5178.         (label_ref (match_operand 1 "" ""))
  5179.         (pc)))
  5180.      (set (match_dup 0)
  5181.       (plus:HI (match_dup 0)
  5182.            (const_int -1)))])]
  5183.   "DATA_REG_P (operands[0])"
  5184.   "*
  5185. {
  5186.   CC_STATUS_INIT;
  5187.   output_dbcc_and_branch (operands);
  5188.   return \"\";
  5189. }")
  5190.  
  5191. (define_peephole
  5192.   [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
  5193.                              [(cc0) (const_int 0)])
  5194.                            (label_ref (match_operand 2 "" ""))
  5195.                            (pc)))
  5196.    (parallel
  5197.     [(set (pc)
  5198.       (if_then_else
  5199.         (ge (plus:SI (match_operand:SI 0 "register_operand" "+d")
  5200.                  (const_int -1))
  5201.             (const_int 0))
  5202.         (label_ref (match_operand 1 "" ""))
  5203.         (pc)))
  5204.      (set (match_dup 0)
  5205.       (plus:SI (match_dup 0)
  5206.            (const_int -1)))])]
  5207.   "DATA_REG_P (operands[0])"
  5208.   "*
  5209. {
  5210.   CC_STATUS_INIT;
  5211.   output_dbcc_and_branch (operands);
  5212.   return \"\";
  5213. }")
  5214.  
  5215.  
  5216. ;; FPA multiply and add.
  5217. (define_insn ""
  5218.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  5219.     (plus:DF (mult:DF (match_operand:DF 1 "general_operand" "%x,dmF,y")
  5220.               (match_operand:DF 2 "general_operand" "xH,y,y"))
  5221.          (match_operand:DF 3 "general_operand" "xH,y,dmF")))]
  5222.    "TARGET_FPA"
  5223.    "@
  5224.     fpma%.d %1,%w2,%w3,%0
  5225.     fpma%.d %x1,%x2,%x3,%0
  5226.     fpma%.d %x1,%x2,%x3,%0")
  5227.  
  5228. (define_insn ""
  5229.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  5230.     (plus:SF (mult:SF (match_operand:SF 1 "general_operand" "%x,ydmF,y")
  5231.               (match_operand:SF 2 "general_operand" "xH,y,ydmF"))
  5232.          (match_operand:SF 3 "general_operand" "xH,ydmF,ydmF")))]
  5233.    "TARGET_FPA"
  5234.    "@
  5235.     fpma%.s %1,%w2,%w3,%0
  5236.     fpma%.s %1,%2,%3,%0
  5237.     fpma%.s %1,%2,%3,%0")
  5238.  
  5239. ;; FPA Multiply and subtract
  5240. (define_insn ""
  5241.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  5242.     (minus:DF (match_operand:DF 1 "general_operand" "xH,rmF,y")
  5243.           (mult:DF (match_operand:DF 2 "general_operand" "%xH,y,y")
  5244.                (match_operand:DF 3 "general_operand" "x,y,rmF"))))]
  5245.   "TARGET_FPA"
  5246.   "@
  5247.    fpms%.d %3,%w2,%w1,%0
  5248.    fpms%.d %x3,%2,%x1,%0
  5249.    fpms%.d %x3,%2,%x1,%0")
  5250.  
  5251. (define_insn ""
  5252.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  5253.     (minus:SF (match_operand:SF 1 "general_operand" "xH,rmF,yrmF")
  5254.           (mult:SF (match_operand:SF 2 "general_operand" "%xH,rmF,y")
  5255.                (match_operand:SF 3 "general_operand" "x,y,yrmF"))))]
  5256.   "TARGET_FPA"
  5257.   "@
  5258.    fpms%.s %3,%w2,%w1,%0
  5259.    fpms%.s %3,%2,%1,%0
  5260.    fpms%.s %3,%2,%1,%0")
  5261.  
  5262. (define_insn ""
  5263.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  5264.     (minus:DF (mult:DF (match_operand:DF 1 "general_operand" "%xH,y,y")
  5265.                (match_operand:DF 2 "general_operand" "x,y,rmF"))
  5266.           (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
  5267.   "TARGET_FPA"
  5268.   "@
  5269.    fpmr%.d %2,%w1,%w3,%0
  5270.    fpmr%.d %x2,%1,%x3,%0
  5271.    fpmr%.d %x2,%1,%x3,%0")
  5272.  
  5273. (define_insn ""
  5274.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  5275.     (minus:SF (mult:SF (match_operand:SF 1 "general_operand" "%xH,rmF,y")
  5276.                (match_operand:SF 2 "general_operand" "x,y,yrmF"))
  5277.           (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
  5278.   "TARGET_FPA"
  5279.   "@
  5280.    fpmr%.s %2,%w1,%w3,%0
  5281.    fpmr%.s %x2,%1,%x3,%0
  5282.    fpmr%.s %x2,%1,%x3,%0")
  5283.  
  5284. ;; FPA Add and multiply
  5285. (define_insn ""
  5286.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  5287.     (mult:DF (plus:DF (match_operand:DF 1 "general_operand" "%xH,y,y")
  5288.               (match_operand:DF 2 "general_operand" "x,y,rmF"))
  5289.          (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
  5290.   "TARGET_FPA"
  5291.   "@
  5292.    fpam%.d %2,%w1,%w3,%0
  5293.    fpam%.d %x2,%1,%x3,%0
  5294.    fpam%.d %x2,%1,%x3,%0")
  5295.  
  5296. (define_insn ""
  5297.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  5298.     (mult:SF (plus:SF (match_operand:SF 1 "general_operand" "%xH,rmF,y")
  5299.               (match_operand:SF 2 "general_operand" "x,y,yrmF"))
  5300.          (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
  5301.   "TARGET_FPA"
  5302.   "@
  5303.    fpam%.s %2,%w1,%w3,%0
  5304.    fpam%.s %x2,%1,%x3,%0
  5305.    fpam%.s %x2,%1,%x3,%0")
  5306.  
  5307. ;;FPA Subtract and multiply
  5308. (define_insn ""
  5309.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  5310.     (mult:DF (minus:DF (match_operand:DF 1 "general_operand" "xH,y,y")
  5311.                (match_operand:DF 2 "general_operand" "x,y,rmF"))
  5312.          (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
  5313.   "TARGET_FPA"
  5314.   "@
  5315.    fpsm%.d %2,%w1,%w3,%0
  5316.    fpsm%.d %x2,%1,%x3,%0
  5317.    fpsm%.d %x2,%1,%x3,%0")
  5318.  
  5319. (define_insn ""
  5320.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  5321.     (mult:DF (match_operand:DF 1 "general_operand" "xH,rmF,y")
  5322.          (minus:DF (match_operand:DF 2 "general_operand" "xH,y,y")
  5323.                (match_operand:DF 3 "general_operand" "x,y,rmF"))))]
  5324.   "TARGET_FPA"
  5325.   "@
  5326.    fpsm%.d %3,%w2,%w1,%0
  5327.    fpsm%.d %x3,%2,%x1,%0
  5328.    fpsm%.d %x3,%2,%x1,%0")
  5329.  
  5330. (define_insn ""
  5331.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  5332.     (mult:SF (minus:SF (match_operand:SF 1 "general_operand" "xH,rmF,y")
  5333.                (match_operand:SF 2 "general_operand" "x,y,yrmF"))
  5334.          (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
  5335.   "TARGET_FPA"
  5336.   "@
  5337.    fpsm%.s %2,%w1,%w3,%0
  5338.    fpsm%.s %x2,%1,%x3,%0
  5339.    fpsm%.s %x2,%1,%x3,%0")
  5340.  
  5341. (define_insn ""
  5342.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  5343.     (mult:SF (match_operand:SF 1 "general_operand" "xH,rmF,yrmF")
  5344.          (minus:SF (match_operand:SF 2 "general_operand" "xH,rmF,y")
  5345.                (match_operand:SF 3 "general_operand" "x,y,yrmF"))))]
  5346.   "TARGET_FPA"
  5347.   "@
  5348.    fpsm%.s %3,%w2,%w1,%0
  5349.    fpsm%.s %x3,%2,%x1,%0
  5350.    fpsm%.s %x3,%2,%x1,%0")
  5351.  
  5352. ;;;
  5353. ;;; Apple additions to the basic 68K description.
  5354. ;;;
  5355.  
  5356. (define_insn ""
  5357.   [(set (cc0)
  5358.     (match_operand:SF 0 "general_operand" "rm"))]
  5359.   "TARGET_SANE"
  5360.   "* return output_sane_tst (operands, 0x1008, \"FCMPS\");")
  5361.  
  5362. (define_insn ""
  5363.   [(set (cc0)
  5364.     (match_operand:DF 0 "general_operand" "rm"))]
  5365.   "TARGET_SANE"
  5366.   "* return output_sane_tst (operands, 0x0808, \"FCMPD\");")
  5367.  
  5368. (define_expand "tstxf"
  5369.   [(set (cc0)
  5370.     (match_operand:XF 0 "general_operand" ""))]
  5371.   "TARGET_SANE || TARGET_68881"
  5372.   "")
  5373.  
  5374. (define_insn ""
  5375.   [(set (cc0)
  5376.     (match_operand:XF 0 "general_operand" "f"))]
  5377.   "TARGET_68881"
  5378.   "*
  5379. {
  5380.   cc_status.flags = CC_IN_68881;
  5381.   return \"ftest.x %0\";
  5382. }")
  5383.  
  5384. (define_insn ""
  5385.   [(set (cc0)
  5386.     (match_operand:XF 0 "general_operand" "rm"))]
  5387.   "TARGET_SANE"
  5388.   "* return output_sane_tst (operands, 0x0008, \"FCMPX\");")
  5389.  
  5390. ;; compares
  5391.  
  5392. (define_insn ""
  5393.   [(set (cc0)
  5394.     (compare (match_operand:SF 0 "general_operand" "rm")
  5395.          (match_operand:SF 1 "general_operand" "rm")))]
  5396.   "TARGET_SANE"
  5397.   "* return output_sane_cmp (operands, 0x1008, \"FCMPS\");")
  5398.  
  5399. (define_insn ""
  5400.   [(set (cc0)
  5401.     (compare (match_operand:DF 0 "general_operand" "rm")
  5402.          (match_operand:DF 1 "general_operand" "rm")))]
  5403.   "TARGET_SANE"
  5404.   "* return output_sane_cmp (operands, 0x0808, \"FCMPD\");")
  5405.  
  5406. (define_expand "cmpxf"
  5407.   [(set (cc0)
  5408.     (compare (match_operand:XF 0 "general_operand" "")
  5409.          (match_operand:XF 1 "general_operand" "")))]
  5410.   "TARGET_SANE || TARGET_68881"
  5411.   "")
  5412.  
  5413. (define_insn ""
  5414.   [(set (cc0)
  5415.     (compare (match_operand:XF 0 "general_operand" "f,mG")
  5416.          (match_operand:XF 1 "general_operand" "fmG,f")))]
  5417.   "TARGET_68881"
  5418.   "*
  5419. {
  5420.   cc_status.flags = CC_IN_68881; 
  5421.   if (REG_P (operands[0]))
  5422.     return \"fcmp.x %1,%0\";
  5423.   cc_status.flags |= CC_REVERSED;
  5424.   return \"fcmp.x %0,%1\";
  5425. }")
  5426.  
  5427. (define_insn ""
  5428.   [(set (cc0)
  5429.     (compare (match_operand:XF 0 "general_operand" "rm")
  5430.          (match_operand:XF 1 "general_operand" "rm")))]
  5431.   "TARGET_SANE"
  5432.   "* return output_sane_cmp(operands, 0x0008, \"FCMPX\");")
  5433.  
  5434. ;; In the following defn, note that FP regs occur iff nums are 96 bits.
  5435. (define_insn "movxf"
  5436.   [(set (match_operand:XF 0 "general_operand" "=&ro<>f")
  5437.     (match_operand:XF 1 "general_operand" "ro<>fF"))]
  5438.   ""
  5439.   "*
  5440. {
  5441.   if (FP_REG_P (operands[0]))
  5442.     {
  5443.       if (FP_REG_P (operands[1]))
  5444.     return \"fmove.x %1,%0\";
  5445.       if (REG_P (operands[1]))
  5446.     {
  5447.       rtx xoperands[2], xxoperands[2];
  5448.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  5449.       xxoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
  5450.       output_asm_insn (\"move.l %1,-(sp)\", xxoperands);
  5451.       output_asm_insn (\"move.l %1,-(sp)\", xoperands);
  5452.       output_asm_insn (\"move.l %1,-(sp)\", operands);
  5453.       return \"fmove.x (sp)+,%0\";
  5454.     }
  5455.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  5456.     return output_move_const_long_double (operands);
  5457.       return \"fmove.x %1,%0\";
  5458.     }
  5459.   else if (FP_REG_P (operands[1]))
  5460.     {
  5461.       if (REG_P (operands[0]))
  5462.     {
  5463.       output_asm_insn (\"fmove.x %1,-(sp)\;move.l (sp)+,%0\", operands);
  5464.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  5465.       output_asm_insn (\"move.l (sp)+,%0\", operands);
  5466.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  5467.       return \"move.l (sp)+,%0\";
  5468.     }
  5469.       else
  5470.         return \"fmove.x %1,%0\";
  5471.     }
  5472.   return output_move_extended (operands);
  5473. }
  5474. ")
  5475.  
  5476. (define_insn ""
  5477.   [(set (match_operand:DF 0 "general_operand" "=rm")
  5478.     (float_extend:DF
  5479.       (match_operand:SF 1 "general_operand" "rm")))]
  5480.   "TARGET_SANE"
  5481.   "* return output_sane_convert(operands);")
  5482.  
  5483. (define_expand "extendsfxf2"
  5484.   [(set (match_operand:XF 0 "general_operand" "")
  5485.     (float_extend:XF
  5486.       (match_operand:SF 1 "general_operand" "")))]
  5487.   "TARGET_SANE || TARGET_68881"
  5488.   "")
  5489.  
  5490. (define_insn ""
  5491.   [(set (match_operand:XF 0 "general_operand" "=*fm,f")
  5492.     (float_extend:XF
  5493.       (match_operand:SF 1 "general_operand" "f,dmF")))]
  5494.   "TARGET_68881"
  5495.   "*
  5496. {
  5497.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  5498.     {
  5499.       if (REGNO (operands[0]) == REGNO (operands[1]))
  5500.     {
  5501.       /* Extending float to long double in an fp-reg is a no-op.
  5502.          NOTICE_UPDATE_CC has already assumed that the
  5503.          cc will be set.  So cancel what it did.  */
  5504.       cc_status = cc_prev_status;
  5505.       return \"\";
  5506.     }
  5507.       return \"fmove.x %1,%0\";
  5508.     }
  5509.   if (FP_REG_P (operands[0]))
  5510.     return \"fmove.s %1,%0\";
  5511.   return \"fmove.x %1,%0\";
  5512. }")
  5513.  
  5514. (define_insn ""
  5515.   [(set (match_operand:XF 0 "general_operand" "=rm")
  5516.     (float_extend:XF
  5517.       (match_operand:SF 1 "general_operand" "rm")))]
  5518.   "TARGET_SANE"
  5519.   "* return output_sane_convert(operands);")
  5520.  
  5521. (define_expand "extenddfxf2"
  5522.   [(set (match_operand:XF 0 "general_operand" "")
  5523.     (float_extend:XF
  5524.       (match_operand:DF 1 "general_operand" "")))]
  5525.   "TARGET_SANE || TARGET_68881"
  5526.   "")
  5527.  
  5528. (define_insn ""
  5529.   [(set (match_operand:XF 0 "general_operand" "=rm")
  5530.     (float_extend:XF
  5531.       (match_operand:DF 1 "general_operand" "rm")))]
  5532.   "TARGET_SANE"
  5533.   "* return output_sane_convert (operands);")
  5534.  
  5535. (define_insn ""
  5536.   [(set (match_operand:XF 0 "general_operand" "=*fm,f")
  5537.     (float_extend:XF
  5538.       (match_operand:DF 1 "general_operand" "f,mF")))]
  5539.   "TARGET_68881"
  5540.   "*
  5541. {
  5542.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  5543.     {
  5544.       if (REGNO (operands[0]) == REGNO (operands[1]))
  5545.     {
  5546.       /* Extending double to long double in an fp-reg is a no-op.
  5547.          NOTICE_UPDATE_CC has already assumed that the
  5548.          cc will be set.  So cancel what it did.  */
  5549.       cc_status = cc_prev_status;
  5550.       return \"\";
  5551.     }
  5552.       return \"fmove.x %1,%0\";
  5553.     }
  5554.   if (FP_REG_P (operands[0]))
  5555.     return \"fmove.d %1,%0\";
  5556.   return \"fmove.x %1,%0\";
  5557. }")
  5558.  
  5559. ;; Truncation of floats.
  5560.  
  5561. (define_expand "truncxfsf2"
  5562.   [(set (match_operand:SF 0 "general_operand" "")
  5563.     (float_truncate:SF
  5564.       (match_operand:XF 1 "general_operand" "")))]
  5565.   "TARGET_SANE || TARGET_68881"
  5566.   "")
  5567.  
  5568. (define_insn ""
  5569.   [(set (match_operand:SF 0 "general_operand" "=dm")
  5570.     (float_truncate:SF
  5571.       (match_operand:XF 1 "general_operand" "f")))]
  5572.   "TARGET_68881"
  5573.   "fmove.s %1,%0")
  5574.  
  5575. (define_insn ""
  5576.   [(set (match_operand:SF 0 "general_operand" "=rm")
  5577.     (float_truncate:SF
  5578.       (match_operand:XF 1 "general_operand" "rm")))]
  5579.   "TARGET_SANE"
  5580.   "* return output_sane_convert (operands);")
  5581.  
  5582. (define_expand "truncxfdf2"
  5583.   [(set (match_operand:DF 0 "general_operand" "")
  5584.     (float_truncate:DF
  5585.       (match_operand:XF 1 "general_operand" "")))]
  5586.   "TARGET_SANE || TARGET_68881"
  5587.   "")
  5588.  
  5589. (define_insn ""
  5590.   [(set (match_operand:DF 0 "general_operand" "=rm")
  5591.     (float_truncate:DF
  5592.       (match_operand:XF 1 "general_operand" "rm")))]
  5593.   "TARGET_SANE"
  5594.   "* return output_sane_convert (operands);")
  5595.  
  5596. ;; This cannot output into an f-reg because there is no way to be
  5597. ;; sure of truncating in that case.
  5598.  
  5599. (define_insn ""
  5600.   [(set (match_operand:DF 0 "general_operand" "=dm")
  5601.     (float_truncate:DF
  5602.       (match_operand:XF 1 "general_operand" "f")))]
  5603.   "TARGET_68881"
  5604.   "*
  5605. {
  5606.   if (DATA_REG_P (operands[0]))
  5607.     {
  5608.       output_asm_insn (\"fmove.d %1,-(sp)\;move.l (sp)+,%0\", operands);
  5609.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  5610.       return \"move.l (sp)+,%0\";
  5611.     }
  5612.   return \"fmove.d %1,%0\";
  5613. }")
  5614.  
  5615. (define_expand "floatsixf2"
  5616.   [(set (match_operand:XF 0 "general_operand" "")
  5617.     (float:XF (match_operand:SI 1 "general_operand" "")))]
  5618.   "TARGET_SANE || TARGET_68881"
  5619.   "")
  5620.  
  5621. (define_insn ""
  5622.   [(set (match_operand:XF 0 "general_operand" "=f")
  5623.     (float:XF (match_operand:SI 1 "general_operand" "dmi")))]
  5624.   "TARGET_68881"
  5625.   "fmove.l %1,%0")
  5626.  
  5627. (define_insn ""
  5628.   [(set (match_operand:XF 0 "general_operand" "=rm")
  5629.     (float:XF (match_operand:SI 1 "general_operand" "rm")))]
  5630.   "TARGET_SANE"
  5631.   "* return output_sane_convert (operands);")
  5632.  
  5633. (define_insn "floathixf2"
  5634.   [(set (match_operand:XF 0 "general_operand" "=f")
  5635.     (float:XF (match_operand:HI 1 "general_operand" "dmn")))]
  5636.   "TARGET_68881"
  5637.   "fmove.w %1,%0")
  5638.  
  5639. (define_insn "floatqixf2"
  5640.   [(set (match_operand:XF 0 "general_operand" "=f")
  5641.     (float:XF (match_operand:QI 1 "general_operand" "dmn")))]
  5642.   "TARGET_68881"
  5643.   "fmove.b %1,%0")
  5644.  
  5645. (define_insn ""
  5646.   [(set (match_operand:SF 0 "general_operand" "=rm")
  5647.     (fix:SF (match_operand:SF 1 "general_operand" "0")))]
  5648.   "TARGET_SANE"
  5649.   "* return output_sane_2 (operands, 0x0016, \"FTINTX\");")
  5650.  
  5651. (define_insn ""
  5652.   [(set (match_operand:DF 0 "general_operand" "=ro")
  5653.     (fix:DF (match_operand:DF 1 "general_operand" "0")))]
  5654.   "TARGET_SANE"
  5655.   "* return output_sane_2 (operands, 0x0016, \"FTINTX\");")
  5656.  
  5657. (define_expand "ftruncxf2"
  5658.   [(set (match_operand:XF 0 "general_operand" "")
  5659.     (fix:XF (match_operand:XF 1 "general_operand" "")))]
  5660.   "TARGET_SANE || TARGET_68881"
  5661.   "")
  5662.  
  5663. (define_insn ""
  5664.   [(set (match_operand:XF 0 "general_operand" "=ro")
  5665.     (fix:XF (match_operand:XF 1 "general_operand" "0")))]
  5666.   "TARGET_SANE"
  5667.   "* return output_sane_2 (operands, 0x0016, \"FTINTX\");")
  5668.  
  5669. (define_insn ""
  5670.   [(set (match_operand:XF 0 "general_operand" "=f")
  5671.     (fix:XF (match_operand:XF 1 "general_operand" "fmF")))]
  5672.   "TARGET_68881"
  5673.   "fintrz.x %1,%0")
  5674.  
  5675. (define_insn "fixxfhi2"
  5676.   [(set (match_operand:HI 0 "general_operand" "=dm")
  5677.     (fix:HI (match_operand:XF 1 "general_operand" "f")))]
  5678.   "TARGET_68881"
  5679.   "fmove.w %1,%0")
  5680.  
  5681. (define_expand "fixxfsi2"
  5682.   [(set (match_operand:SI 0 "general_operand" "")
  5683.     (fix:SI (match_operand:XF 1 "general_operand" "")))]
  5684.   "TARGET_SANE || TARGET_68881"
  5685.   "")
  5686. (define_insn ""
  5687.   [(set (match_operand:SI 0 "general_operand" "=dm")
  5688.     (fix:SI (match_operand:XF 1 "general_operand" "rm")))]
  5689.   "TARGET_SANE"
  5690.   "* return output_lib_convert(operands, \"_XTOI\");")
  5691.  
  5692. (define_insn ""
  5693.   [(set (match_operand:SI 0 "general_operand" "=dm")
  5694.     (fix:SI (match_operand:XF 1 "general_operand" "f")))]
  5695.   "TARGET_68881"
  5696.   "fmove.l %1,%0")
  5697.  
  5698. ;(define_expand "fixunsdfsi2"
  5699. ;  [(set (match_operand:SI 0 "general_operand" "")
  5700. ;    (unsigned_fix:SI (match_operand:DF 1 "general_operand" "")))]
  5701. ;  "TARGET_SANE || TARGET_68881"
  5702. ;  "")
  5703.  
  5704. (define_expand "fixunsxfsi2"
  5705.   [(set (match_operand:SI 0 "general_operand" "")
  5706.     (unsigned_fix:SI (match_operand:XF 1 "general_operand" "")))]
  5707.   "TARGET_SANE || TARGET_68881"
  5708.   "")
  5709.  
  5710. (define_insn ""
  5711.   [(set (match_operand:SI 0 "general_operand" "=dm")
  5712.     (unsigned_fix:SI (match_operand:XF 1 "general_operand" "rm")))]
  5713.   "TARGET_SANE"
  5714.   "* return output_lib_convert(operands, \"_XTOU\");")
  5715.  
  5716. (define_insn ""
  5717.   [(set (match_operand:SI 0 "general_operand" "=do")
  5718.     (unsigned_fix:SI (match_operand:XF 1 "general_operand" "f")))]
  5719.   "TARGET_68881"
  5720.   "* return output_lib_convert(operands, \"_X96TOU\");")
  5721.  
  5722. (define_insn ""
  5723.   [(set (match_operand:SF 0 "general_operand" "=rm")
  5724.     (plus:SF (match_operand:SF 1 "general_operand" "%0")
  5725.          (match_operand:SF 2 "general_operand" "rm")))]
  5726.   "TARGET_SANE"
  5727.   "* return output_sane_3 (operands, 0x1000, \"FADDS\");")
  5728.  
  5729. (define_insn ""
  5730.   [(set (match_operand:DF 0 "general_operand" "=rm")
  5731.     (plus:DF (match_operand:DF 1 "general_operand" "%0")
  5732.          (match_operand:DF 2 "general_operand" "rm")))]
  5733.   "TARGET_SANE"
  5734.   "* return output_sane_3 (operands, 0x0800, \"FADDD\");")
  5735.  
  5736. (define_expand "addxf3"
  5737.   [(set (match_operand:XF 0 "general_operand" "")
  5738.     (plus:XF (match_operand:XF 1 "general_operand" "")
  5739.          (match_operand:XF 2 "general_operand" "")))]
  5740.   "TARGET_SANE || TARGET_68881"
  5741.   "")
  5742.  
  5743. (define_insn ""
  5744.   [(set (match_operand:XF 0 "general_operand" "=f")
  5745.     (plus:XF (match_operand:XF 1 "general_operand" "%0")
  5746.          (match_operand:XF 2 "general_operand" "fmG")))]
  5747.   "TARGET_68881"
  5748.   "fadd.x %2,%0")
  5749.  
  5750. (define_insn ""
  5751.   [(set (match_operand:XF 0 "general_operand" "=rm")
  5752.     (plus:XF (match_operand:XF 1 "general_operand" "%0")
  5753.          (match_operand:XF 2 "general_operand" "rm")))]
  5754.   "TARGET_SANE"
  5755.   "* return output_sane_3 (operands, 0x0000, \"FADDX\");")
  5756.  
  5757. (define_insn ""
  5758.   [(set (match_operand:SF 0 "general_operand" "=rm")
  5759.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  5760.           (match_operand:SF 2 "general_operand" "rm")))]
  5761.   "TARGET_SANE"
  5762.   "* return output_sane_3 (operands, 0x1002, \"FSUBS\");")
  5763.  
  5764. (define_insn ""
  5765.   [(set (match_operand:DF 0 "general_operand" "=rm")
  5766.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  5767.           (match_operand:DF 2 "general_operand" "rm")))]
  5768.   "TARGET_SANE"
  5769.   "* return output_sane_3 (operands, 0x0802, \"FSUBD\");")
  5770.  
  5771. (define_expand "subxf3"
  5772.   [(set (match_operand:XF 0 "general_operand" "")
  5773.     (minus:XF (match_operand:XF 1 "general_operand" "")
  5774.           (match_operand:XF 2 "general_operand" "")))]
  5775.   "TARGET_SANE || TARGET_68881"
  5776.   "")
  5777.  
  5778. (define_insn ""
  5779.   [(set (match_operand:XF 0 "general_operand" "=f")
  5780.     (minus:XF (match_operand:XF 1 "general_operand" "0")
  5781.           (match_operand:XF 2 "general_operand" "fmG")))]
  5782.   "TARGET_68881"
  5783.   "fsub.x %2,%0")
  5784.  
  5785. (define_insn ""
  5786.   [(set (match_operand:XF 0 "general_operand" "=rm")
  5787.     (minus:XF (match_operand:XF 1 "general_operand" "0")
  5788.           (match_operand:XF 2 "general_operand" "rm")))]
  5789.   "TARGET_SANE"
  5790.   "* return output_sane_3 (operands, 0x0002, \"FSUBX\");")
  5791.  
  5792. (define_insn ""
  5793.   [(set (match_operand:SI 0 "general_operand" "=d")
  5794.     (mult:SI (match_operand:SI 1 "general_operand" "%0")
  5795.          (match_operand:SI 2 "general_operand" "dsK")))]
  5796.   "TARGET_INTLIB"
  5797.   "* return output_int_lib_call (operands, \"ULMULT\");")
  5798.  
  5799. ;Changed this one from umult to mult with a zero_extened rtx
  5800. (define_insn ""
  5801.   [(set (match_operand:SI 0 "general_operand" "=d")
  5802.     (mult:SI (zero_extend:SI
  5803.           (match_operand:SI 1 "general_operand" "%0"))
  5804.          (zero_extend:SI
  5805.           (match_operand:SI 2 "general_operand" "dsK"))))]
  5806.   "TARGET_INTLIB"
  5807.  "* return output_int_lib_call (operands, \"ULMULT\");")
  5808.  
  5809. (define_insn ""
  5810.   [(set (match_operand:DF 0 "general_operand" "=rm")
  5811.     (mult:DF (match_operand:DF 1 "general_operand" "%0")
  5812.          (match_operand:DF 2 "general_operand" "rm")))]
  5813.   "TARGET_SANE"
  5814.   "* return output_sane_3 (operands, 0x0804, \"FMULD\");")
  5815.  
  5816. ;;; Expansion of extended multiplication.
  5817.  
  5818. (define_expand "mulxf3"
  5819.   [(set (match_operand:XF 0 "general_operand" "")
  5820.     (mult:XF (match_operand:XF 1 "general_operand" "")
  5821.          (match_operand:XF 2 "general_operand" "")))]
  5822.   "TARGET_SANE || TARGET_68881"
  5823.   "")
  5824.  
  5825. (define_insn ""
  5826.   [(set (match_operand:XF 0 "general_operand" "=f")
  5827.     (mult:XF (match_operand:XF 1 "general_operand" "%0")
  5828.          (match_operand:XF 2 "general_operand" "fmG")))]
  5829.   "TARGET_68881"
  5830.   "fmul.x %2,%0")
  5831.  
  5832. (define_insn ""
  5833.   [(set (match_operand:XF 0 "general_operand" "=rm")
  5834.     (mult:XF (match_operand:XF 1 "general_operand" "%0")
  5835.          (match_operand:XF 2 "general_operand" "rm")))]
  5836.   "TARGET_SANE"
  5837.   "* return output_sane_3 (operands, 0x0004, \"FMULX\");")
  5838.  
  5839. ;;; Single integer division using the integer library function.
  5840. ;This will never get matched because it is not expanded, BHP 6-30
  5841. ;(define_insn ""
  5842. ;  [(set (match_operand:SI 0 "general_operand" "=d")
  5843. ;    (div:SI (match_operand:SI 1 "general_operand" "0")
  5844. ;        (match_operand:SI 2 "general_operand" "dsK")))]
  5845. ;  "TARGET_INTLIB"
  5846. ;  "* return output_int_lib_call (operands, \"LDIVT\");")
  5847.  
  5848. ;This will never get matched because it is not expanded, BHP 6-30
  5849. ;(define_insn ""
  5850. ;  [(set (match_operand:SI 0 "general_operand" "=d")
  5851. ;    (udiv:SI (match_operand:SI 1 "general_operand" "0")
  5852. ;         (match_operand:SI 2 "general_operand" "dsK")))]
  5853. ;  "TARGET_INTLIB"
  5854. ;  "* return output_int_lib_call (operands, \"ULDIVT\");")
  5855.  
  5856. ;;; Single and double float division.
  5857.  
  5858. (define_insn ""
  5859.   [(set (match_operand:SF 0 "general_operand" "=rm")
  5860.     (div:SF (match_operand:SF 1 "general_operand" "0")
  5861.          (match_operand:SF 2 "general_operand" "rm")))]
  5862.   "TARGET_SANE"
  5863.   "* return output_sane_3 (operands, 0x1006, \"FDIVS\");")
  5864.  
  5865. (define_insn ""
  5866.   [(set (match_operand:DF 0 "general_operand" "=rm")
  5867.     (div:DF (match_operand:DF 1 "general_operand" "0")
  5868.          (match_operand:DF 2 "general_operand" "rm")))]
  5869.   "TARGET_SANE"
  5870.   "* return output_sane_3 (operands, 0x0806, \"FDIVD\");")
  5871.  
  5872. ;;; Extended float division.
  5873.  
  5874. (define_expand "divxf3"
  5875.   [(set (match_operand:XF 0 "general_operand" "")
  5876.     (div:XF (match_operand:XF 1 "general_operand" "")
  5877.          (match_operand:XF 2 "general_operand" "")))]
  5878.   "TARGET_SANE || TARGET_68881"
  5879.   "")
  5880.  
  5881. (define_insn ""
  5882.   [(set (match_operand:XF 0 "general_operand" "=f")
  5883.     (div:XF (match_operand:XF 1 "general_operand" "0")
  5884.          (match_operand:XF 2 "general_operand" "fmG")))]
  5885.   "TARGET_68881"
  5886.   "fdiv.x %2,%0")
  5887.  
  5888. (define_insn ""
  5889.   [(set (match_operand:XF 0 "general_operand" "=rm")
  5890.     (div:XF (match_operand:XF 1 "general_operand" "0")
  5891.          (match_operand:XF 2 "general_operand" "rm")))]
  5892.   "TARGET_SANE"
  5893.   "* return output_sane_3 (operands, 0x0006, \"FDIVX\");")
  5894.  
  5895. ;;; Single and double float negation.
  5896.  
  5897. (define_insn ""
  5898.   [(set (match_operand:SF 0 "general_operand" "=rm")
  5899.     (neg:SF (match_operand:SF 1 "general_operand" "0")))]
  5900.   "TARGET_SANE"
  5901.   "* return output_sane_2 (operands, 0x000d, \"FNEGX\");")
  5902.  
  5903. (define_insn ""
  5904.   [(set (match_operand:DF 0 "general_operand" "=rm")
  5905.     (neg:DF (match_operand:DF 1 "general_operand" "0")))]
  5906.   "TARGET_SANE"
  5907.   "* return output_sane_2 (operands, 0x000d, \"FNEGX\");")
  5908.  
  5909. ;;; Extended float negation.
  5910.  
  5911. (define_expand "negxf2"
  5912.   [(set (match_operand:XF 0 "general_operand" "")
  5913.     (neg:XF (match_operand:XF 1 "general_operand" "")))]
  5914.   "TARGET_SANE || TARGET_68881"
  5915.   "")
  5916.  
  5917. (define_insn ""
  5918.   [(set (match_operand:XF 0 "general_operand" "=f")
  5919.     (neg:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5920.   "TARGET_68881"
  5921.   "fneg.x %1,%0")
  5922.  
  5923. (define_insn ""
  5924.   [(set (match_operand:XF 0 "general_operand" "=rm")
  5925.     (neg:XF (match_operand:XF 1 "general_operand" "0")))]
  5926.   "TARGET_SANE"
  5927.   "* return output_sane_2 (operands, 0x000d, \"FNEGX\");")
  5928.  
  5929. ;; Assorted math function handling.
  5930.  
  5931. ;; These are fairly uniform, take one operand from reg or memory or
  5932. ;; const, put result in another float register.
  5933.  
  5934. (define_insn "sinxf2"
  5935.   [(set (match_operand:XF 0 "general_operand" "=f")
  5936.     (sin:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5937.   "TARGET_ELEMS881"
  5938.   "fsin.x %1,%0")
  5939.  
  5940. (define_insn "cosxf2"
  5941.   [(set (match_operand:XF 0 "general_operand" "=f")
  5942.     (cos:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5943.   "TARGET_ELEMS881"
  5944.   "fcos.x %1,%0")
  5945.  
  5946. (define_insn "tanxf2"
  5947.   [(set (match_operand:XF 0 "general_operand" "=f")
  5948.     (tan:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5949.   "TARGET_ELEMS881"
  5950.   "ftan.x %1,%0")
  5951.  
  5952. (define_insn "asinxf2"
  5953.   [(set (match_operand:XF 0 "general_operand" "=f")
  5954.     (asin:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5955.   "TARGET_ELEMS881"
  5956.   "fasin.x %1,%0")
  5957.  
  5958. (define_insn "acosxf2"
  5959.   [(set (match_operand:XF 0 "general_operand" "=f")
  5960.     (acos:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5961.   "TARGET_ELEMS881"
  5962.   "facos.x %1,%0")
  5963.  
  5964. (define_insn "atanxf2"
  5965.   [(set (match_operand:XF 0 "general_operand" "=f")
  5966.     (atan:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5967.   "TARGET_ELEMS881"
  5968.   "fatan.x %1,%0")
  5969.  
  5970. (define_insn "sinhxf2"
  5971.   [(set (match_operand:XF 0 "general_operand" "=f")
  5972.     (sinh:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5973.   "TARGET_ELEMS881"
  5974.   "fsinh.x %1,%0")
  5975.  
  5976. (define_insn "coshxf2"
  5977.   [(set (match_operand:XF 0 "general_operand" "=f")
  5978.     (cosh:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5979.   "TARGET_ELEMS881"
  5980.   "fcosh.x %1,%0")
  5981.  
  5982. (define_insn "tanhxf2"
  5983.   [(set (match_operand:XF 0 "general_operand" "=f")
  5984.     (tanh:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5985.   "TARGET_ELEMS881"
  5986.   "ftanh.x %1,%0")
  5987.  
  5988. (define_insn "expxf2"
  5989.   [(set (match_operand:XF 0 "general_operand" "=f")
  5990.     (exp:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5991.   "TARGET_ELEMS881"
  5992.   "fetox.x %1,%0")
  5993.  
  5994. (define_insn "logxf2"
  5995.   [(set (match_operand:XF 0 "general_operand" "=f")
  5996.     (log:XF (match_operand:XF 1 "general_operand" "fmG")))]
  5997.   "TARGET_ELEMS881"
  5998.   "flogn.x %1,%0")
  5999.  
  6000. (define_insn "log10xf2"
  6001.   [(set (match_operand:XF 0 "general_operand" "=f")
  6002.     (log10:XF (match_operand:XF 1 "general_operand" "fmG")))]
  6003.   "TARGET_ELEMS881"
  6004.   "flog10.x %1,%0")
  6005.  
  6006. (define_insn "sqrtxf2"
  6007.   [(set (match_operand:XF 0 "general_operand" "=f")
  6008.     (sqrt:XF (match_operand:XF 1 "general_operand" "fmG")))]
  6009.   "TARGET_ELEMS881"
  6010.   "fsqrt.x %1,%0")
  6011.  
  6012. ;; Don't bother trying to make SANE math calls directly, -elems881
  6013. ;; implies -mc68881 anyway.
  6014.  
  6015. (define_insn ""
  6016.   [(set (match_operand:SF 0 "general_operand" "=rm")
  6017.     (abs:SF (match_operand:SF 1 "general_operand" "0")))]
  6018.   "TARGET_SANE"
  6019.   "* return output_sane_2 (operands, 0x000f, \"FABSX\");")
  6020.  
  6021. (define_insn ""
  6022.   [(set (match_operand:DF 0 "general_operand" "=ro")
  6023.     (abs:DF (match_operand:DF 1 "general_operand" "0")))]
  6024.   "TARGET_SANE"
  6025.   "* return output_sane_2 (operands, 0x000f, \"FABSX\");")
  6026.  
  6027. (define_expand "absxf2"
  6028.   [(set (match_operand:XF 0 "general_operand" "")
  6029.     (abs:XF (match_operand:XF 1 "general_operand" "")))]
  6030.   "TARGET_SANE || TARGET_68881"
  6031.   "")
  6032.  
  6033. (define_insn ""
  6034.   [(set (match_operand:XF 0 "general_operand" "=f")
  6035.     (abs:XF (match_operand:XF 1 "general_operand" "fmG")))]
  6036.   "TARGET_68881"
  6037.   "fabs.x %1,%0")
  6038.  
  6039. (define_insn ""
  6040.   [(set (match_operand:XF 0 "general_operand" "=rm")
  6041.     (abs:XF (match_operand:XF 1 "general_operand" "0")))]
  6042.   "TARGET_SANE"
  6043.   "* return output_sane_2 (operands, 0x000f, \"FABSX\");")
  6044.  
  6045.  
  6046. ;;- Local variables:
  6047. ;;- mode:emacs-lisp
  6048. ;;- comment-start: ";;- "
  6049. ;;- comment-start-skip: ";+- *"
  6050. ;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
  6051. ;;- eval: (modify-syntax-entry ?[ "(]")
  6052. ;;- eval: (modify-syntax-entry ?] ")[")
  6053. ;;- eval: (modify-syntax-entry ?{ "(}")
  6054. ;;- eval: (modify-syntax-entry ?} "){")
  6055. ;;- End:
  6056.